28

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?

0

2 Answers 2

25

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.

4
  • 8
    For me this only finds instances where the opening and closing para tags are on a single line :( (I'm on v 1.16.0 ia32) Commented Apr 19, 2017 at 14:57
  • is where a way without regular expression?
    – Wlad
    Commented Sep 17, 2019 at 12:09
  • @Wlad that will be up to the makers of Atom to implement this as a proper feature. (Dear creators of Atom: please?) Commented Apr 10, 2020 at 0:14
  • This works, but only on a single file (ctrl-F), for multiple files (ctrl-shift-F) it seems to not find it. I have not found a workaround.
    – SvennD
    Commented Mar 13, 2022 at 11:19
4

Try the regex [\s\S]*?, with your example <p>[\s\S]*?</p>

see also https://github.com/atom/find-and-replace/issues/303

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.