in reply to s/// don't delete matching phrase
If you hit a point where regex isn't working for you, consider one of the parsers on CPAN. For instance HTML::HTML5::Parser can make quick work of removing all the tags:
Output:use HTML::HTML5::Parser; my $parser = HTML::HTML5::Parser->new; my $doc = $parser->parse_string(<<'EOT'); <?xml version="1.0" encoding="UTF-8"?> <title>Foo</title> <p><b><i>Foo</b> bar</i>. <p>Baz</br>Quux. EOT print $doc->textContent;
Foo Foo bar. BazQuux.
|
|---|