I need to delete all html tags, such as <p style="text-align: center;">
, but except </em>
and </em>
from the html tag <p class="glovo"></p>
EXAMPLE:
<p class="glovo">In these <p style="text-align: center;"> situations we may be forgetting to really <em>bend</em> at our practice and <em>sweat</em> at it.</p>
MUST BECOME:
<p class="glovo">In these situations we may be forgetting to really <em>bend</em> at our practice and <em>sweat</em> at it.</p>
I use this GENERIC formula:
REGION-START(?=(?:(?!REGION-FINAL).)*?FIND REGEX)(?=(?:(?!REGION-FINAL).)).+?REGION-FINAL\R?
REGION-START = <p class="glovo">
REGION-FINAL = </p>
FIND REGEX = <(?!/)[^>]*[^/]>(?!<em>|</em>)
So, my final regex becomes:
FIND:
<p class="glovo">(?=(?:(?!</p>).)*?<(?!/)[^>]*[^/]>(?!<em>|</em>))(?=(?:(?!</p>).)).+?</p>\R?
REPLACE BY: (LEAVE EMPTY)
The problem is that my regex selects THE ENTIRE html tag, not just the tags inside it. Can anyone help me?