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
Use the replace in files dialog Ctrl-Shift-H and the single line option (?s)
:
(?s)start.*end
finds
start
two
three
end
Singleline means: each file is treated as single line, dot .
matches newline \n
. Downside: you must use Find All and replace all, or replace by hand. Find next does not work.
For the non-modal dialog Ctrl-H and find next, use (.*\n)*
to match any number of lines:
start(.*\n)*.*end
Either way, you can replace your findings with multiple lines by inserting \n
.