How can I retrieve all lines of a document containing "strA", but not "strB", in the Visual Studio search box?
For Visual Studio 2012 (and newer versions):
^(?!.*strB).*strA.*$
Explanation:
^ # Anchor the search at the start of the line
(?!.*strB) # Make sure that strB isn't on the current line
.*strA.* # Match the entire line if it contains strA
$ # Anchor the search to the end of the line
You might want to add (?:\r\n)?
at the end of the regex if you also want to remove the carriage returns/line feeds along with the rest of the line.