Dave's Brain

Browse - programming tips - perl remove html

Date: 2011jul7
Language: perl
Keywords: defang

Q.  How can I remove the HTML in a string?

A.  An easy way is to just remove everything inside angle brackets
(and the brackets themselves)

	$str =~ s/\<[^\>]*\>//g;

I'm sure this isn't perfect but its nice and easy.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: