Is there any way to get Visual Studio to perform a regex replace across multiple lines (let the match cross line boundaries)? I know there are many editors I can use for this, b
This works today in Visual Studio 2012:
fooPatternToStart.*(.*\n)+?.*barPatternToEnd
See how the (.*\n)+?
part does the match across multiple lines, non-greedy.
fooPatternToStart
is some regex pattern on your start line, while barPatternToEnd
is your pattern to find on another line below, possibly many lines below...
Example found here.
Simple and effective :)
Note: before VS2012, the pattern that worked was: fooPatternToStart.(.\n)+@.*barPatternToEnd