Sublime Forum

Regex match multiline

#1

I am trying to search and remove this (sic, html code generated by adobe acrobat html export)

<P style="text-align:center">
<SPAN style="font-size:6.7pt; "
>51 </SPAN
></P>

I can’t figure out to to do multi line match. When I try this

<P style="text-align:center">(.|\n)+

as soon as I type that in the search box ST crashes. thanks in advance

1 Like

#2

It doesn’t crash for me - are you using either 1.4 or the latest beta?

That regex will do a multi line match, but it’s going to select from the

till the end of the buffer. I’d think you want a regex more along the lines of:

<P style="text-align:center">((?!</P>).|\n)+</P>

The negative lookahead assertion is there because otherwise it’ll find the longest match possible, which is not what you want in this case.

1 Like

#3

thank you, exactly what I needed

1 Like

#4

Just wondering, is regex the only way to do multi-line searches?

1 Like