Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Regular expression question

by clueless newbie (Curate)
on Sep 27, 2019 at 00:12 UTC ( [id://11106776] : note . print w/replies, xml ) Need Help??


in reply to Regular expression question

Have you looked at the Marpa::R2::HTML parser?
use 5.014; use warnings; use <a href="">Marpa::R2::HTML qw(html); my $with_table = <<"HTML"; <!DOCTYPE html> <html> <body> <svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill= +"yellow" /> </svg> </body> </html> HTML my $no_table = html( \$with_table, { svg => sub { return q{} } }); say $$no_table;
yields
<!DOCTYPE html> <html> <body> </body> </html>
It's pretty tolerant --- if we drop the closing </svg> tag ... well, it will return the same answer.