Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Remove all html tag Except 'sup'

by jai_dgl (Beadle)
on Jun 20, 2008 at 10:09 UTC ( [id://693114]=note: print w/replies, xml ) Need Help??


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 :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://693114]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-16 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found