I have been looking for a quick way to do this, and I have come to the following:
start_text.*?(.|[\n])*?end_text
with start_text and end_text being the bounds of your multiline search.
breaking down the regex .*?(.|[\n])*?:
.*? will match any characters from your start text to the end of the line. The ? is there to ensure that if your end_text is on the same line the .* wont just keep going to the end of the line regardless (greedy vs lazy matching)
(.|[\n]) means either a character\whitespace or a new line
*? specifies to match 0 or more of the expression in the parentheses without being greedy.
Examples:
<meta.*?(.|[\n])*?/> will match from the beginning of all meta tags to the end of the respective tags
<script.*?(.|[\n])*?</script> will match from the beginning of all script tags to the respective closing tags
Warning:
Using .*?(.|[\n])*? with improperly or partially filled in start_text or end_text might crash VS Code. I suggest either writing the whole expression out (which doesn't cause a problem) or writing the start and end text before pasting in the regex. In any case, when I tried to delete parts of the starting and ending text VS Code froze and forced me to reload the file. That being said, I honestly could not find something that worked better in VS Code.
((.|\n)*?)
` to find multiline paragraphs in HTML. The external parenthesis allows me to replace using $1. The internal is ignored for replacement purposes. – Toni Homedes i Saun Jul 31 '23 at 11:57