Viktor Carlson Viktor Carlson - 3 months ago 20
HTML Question

Notepad++ RexEx Remove everything between 2 html tags ( with line break between )

I want to remove in a html document with notepad++

everything between the marked area
enter image description here
So the Start point to remove is ( including )

"<imgCRLF"
and then everything between including CRLF
and then including
"DetailsCRLF</aCRLF"
for the End ponint

I started simple with
<img.*<a/>
and ticked enter image description here

and I tried to improve this starting point but always got either nothing was deleted or to much :)

Answer

Use <img.*?</a>[\r\n]*. The .* is too greedy. [\r\n]* will capture the whitespace after </a>.

enter image description here

Also, if you are only interested in matching <img with subsequent line breaks, you can use another regex:

<img[\r\n].*?</a>[\r\n]*