in reply to Strip HTML tags again

This will probably do the trick, however this does not handle HTML tags that span multiple lines. To do that you'll most likely have to join all the lines together into one scalar. This will also not catch multiple HTML tags on the same line, you'll need to modify it to suit your needs.

What this is doing is finding text contained in <>'s that has a corresponding ending tag.

Here is the code ($l is the scalar holding the line of text):

if( $l =~ /<.*?>(.*?)<\/.*?>/ ) { $l = $1; }

-----------------------------------
Frank Wiles <frank@wiles.org>
http://frank.wiles.org

Replies are listed 'Best First'.
Re: Re: Strip HTML tags again
by dda (Friar) on Jun 30, 2002 at 16:03 UTC
    Thanks, but I need a solution which 'knows' about possible HTML tags. What I need is to filter HTML from a chat message, and if someone type '<Hehe>' - it will be wiped off.

    --dda