Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my specific example, for a selection of lines I want to duplicate them inline, separated by an arbitrary marker





Altough I'm mediocre with regex, I believe this should be accomplished by searching for something like:


and replacing with


However I'm unable to get even simple \1 replacements working. Am I doing something wrong?

share|improve this question
up vote 2 down vote accepted

Your replacement regex is correct, however your match will not work as there is only 1 world per line. You are trying to match the replacement text which is not yet there :)

try this:


replace with \1_something_\1.

Make sure you are using regex mode as well.

share|improve this answer
Ty JohnT (and Sonny) for the answer. JohnT. I still don't follow why the search string doesn't work though. Even consdiering just one line (one world) I would have thought that "(string.)_something_(string.)" matches "stringA_something_stringA". – RJFalconer Jan 28 '11 at 18:08
@RJF I thought you were replacing StringA and StringB with stringA_something_stringA and stringB_something_stringB ? In that case you cannot search for text that is not already there. – John T Jan 28 '11 at 18:11
Oh, yeah. Confusing myself there. Tyvm. – RJFalconer Jan 29 '11 at 9:06

Find what: (string.)
Replace with: \1_something_\1

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .