Multiline Search and Replace in Atom editor

Eptin picture Eptin · Jan 6, 2017 · Viewed 8.6k times · Source

I want to find this:

<p>
various text and code
</p>

...and replace it with completely different text. Atom doesn't seem to have a multi-line RegEx flag. How can I accomplish this?

Answer

Eptin picture Eptin · Jan 6, 2017

The regular expression (.|\r?\n)*? is what you're looking for.

Used in the example above, <p>(.|\r?\n)*?</p> will select all three lines and you can then either replace or delete those lines.