How to match all text between two strings multiline

Well unfortunately, RegExr is dependent on the JS RegExp implementation, which does not support the option to enable the flag/modifier that you need.

You are looking for the s (DotAll) modifier forcing the dot . to match newline sequences.

If you are using JavaScript, you can use this workaround:

/<!-- OPTIONAL -->([\S\s]*?)<!-- OPTIONAL END -->/

Leave a Comment