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

How can I find matches just Around text same as this:

if(strcmp(cmdtext, " /x ", true) == 0)

if(strcmp(cmdtext, " /y ", true) == 0)

if(strcmp(cmdtext, " /z ", true) == 0)

Basically, I want to find matches in this format: if(strcmp(cmdtext, " and ", true) == 0)

share|improve this question
up vote 1 down vote accepted

If you make sure Search Mode is set to Regular Expression and . matches newline is not selected, either of the following should work:

if\(strcmp\(cmdtext, ".*?", true\) == 0\)
if\(strcmp\(cmdtext, " /. ", true\) == 0\)

If on the other hand you want to replace the middle section with something else (for example /a) and retain the left and right sections, use this:

Search: (if\(strcmp\(cmdtext, ").*?(", true\) == 0\))

Replace: \1 /a \2

share|improve this answer

You must log in to answer this question.

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