Sublime Forum

Regex: Select html tags that contain <em>, but does not contain </em>

#1

Hello.I have this 2 line. I need a regex to select those html tags that contain <em> , but does not contain </em>

<p class="text_obisnuit2"><em>Leadership: Do you love me?</p>
<p class="text_obisnuit2"><em>Leadership: Do you love me?</em></p>

I made a Regex, but it is not working…

FIND: <p class="text_obisnuit2"><em>.*?(?!<\/em>).*?</p>

OR

FIND: (<p class="text_obisnuit2"><em>)(?!</em>)(.+?</p>)

Can anyone help me a little bit?

0 Likes

#2

done. I find the solution:

FIND: <p class="text_obisnuit2">(?=.*<em>)(?:(?!</em>).)+</p>

OR

FIND: ^(?=.*<em>)(?:(?!</em>).)+$

0 Likes