in reply to Re: Removing characters
in thread Removing characters
Or you could use$string =~ s/<[^>]*>//gs;
The first looks between < and > for any character that's not a >, and the second looks from the first < until it finds a > (the '?' makes it a non-greedy match).$string =~ s/<.*?>//gs;
You don't need the "e" modifier, because you're not executing any code on the right-hand side of the substitution. And you should use the "s" because HTML tags can span multiple lines, so you want the '.' to match newlines.
If you find that the regex really isn't working well enough, take a look at HTML::Parser, HTML::TokeParser, and HTML::FormatText.
|
|---|