----- Original Message ----- 
From: "Craig Cardimon" <[EMAIL PROTECTED]>
To: "ActivePerl" <[email protected]>
Sent: Thursday, February 24, 2005 3:01 PM
Subject: Best way to selectively strip HTML tags


> I need to strip HTML-style "<" and ">" tags and their contents from 
> ASCII text while not disturbing customized tags that might say <TYPE> or 
> <DESCRIPTION>. Is there a way to do this without going bonkers?
> 
> I'm using
> 
> ***
> 
> s/<(?:[^>'"]*|(['"]).*?\1)*>//gs;
> 
> ***
> 
Try this

s/(<)(\/{0,1})(description|type)(>)/[$2$3]/igs;
s/<.+?>/ /igs;
s/\x32+/ /igs;
s/(\[)(\/{0,1})(description|type)(\])/[$2$3]/igs;

Petr Vileta, Czech republic

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to