in reply to Re: Remove all html tag Except 'sup'
in thread Remove all html tag Except 'sup'

Hi its working fine , but not preserving end of sup

Replies are listed 'Best First'.
Re^3: Remove all html tag Except 'sup'
by Anonymous Monk on Jun 20, 2008 at 10:52 UTC
    Its missing a grouping parens
    # you need extra (?:) $tag = qr{</?(?:(?!sup)[^>])*>}i;
      That will also keep <supfoo> and <foosup>. A partial improvement may be
      $tag = qr{</?(?:(?![< ]sup[ >])[^>])*>}i;
      It works, however I'm not terribly sure about why it works...
Re^3: Remove all html tag Except 'sup'
by moritz (Cardinal) on Jun 20, 2008 at 10:44 UTC
    You're right, I updated my regex - should work now.
      It works, but will miss some like < sup > </ sup >, if you add grouping like this it will get them all :)