Doubt with RegEx with new line

Question:

I created the following expression:

"<strike>.*?</strike>" 

to get all the taxed text, but due to the source code having a line break (as in the example below) it is not working.

<p style="margin-top: 0; margin-bottom: 0"><a name="6"></a><strike>Art. 
6º São direitos sociais a educação, a saúde, o
trabalho, o lazer, a segurança, a previdência social, a proteção à maternidade e à
infância, a assistência aos desamparados, na forma desta Constituição.</strike></p>

<p style="margin-top: 0; margin-bottom: 0">
<strike><a name="art6"></a>Art.     6<sup>o</sup> São direitos sociais a educação, a saúde, o
trabalho, a moradia, o lazer, a segurança, a previdência social, a proteção à
maternidade e à infância, a assistência aos desamparados, na forma desta
Constituição.<a href="Emendas/Emc/emc26.htm#1">(Redação dada pela Emenda
Constitucional nº 26, de 2000)</a></strike></p>

I'm using regex in Notepad++ find.

How do I make the regex catch the line break as well?

Answer:

Most engines use . like "any character except line break" . There is usually the m option, which turns on multiline mode and removes the constraint on . . The syntax is usually this:

/<strike>.*?</strike>/m

But it varies from language to language and from each implementation. See the documentation for the engine you are using for more details.

Scroll to Top