Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove HTML tags?

Status
Not open for further replies.

danielhozac

Programmer
Aug 21, 2001
2,058
SE
What I'm trying to do is to get rid of the tag, the whole tag, but the code I'm using obviously doesn't quite work. It removes everything between the start and the end tag, which isn't what I want. This is what I have:
s/\<(\w|(\w\s\w=\&quot;\w(\/|.html)\&quot;)))\>//gi;
As you probably notice this is to remove tags with just one attribute, which is enough at the moment. But how do I get it to just remove the tag?

//Daniel
 
s/<.*?>//gs;

That will replace all occurences of <some stuff> with null.

'hope this helps. If you are new to Tek-Tips, please use descriptive titles, check the FAQs,
and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top