Anyway parsing arbitrary html with regex is normally a waste of time.
Please show us some input to help you.
works for me, stripped the useless (but harmless) esacaping
use strict; use warnings; use Data::Dump qw/pp dd/; my $lsdata = do { local $/;<DATA> }; my @table = $lsdata =~ m/(<tr.*?<\/tr>)/g; pp @table; __DATA__ <tr>bla1</tr><tr>bla2</tr> <tr>bla3</tr>
("<tr>bla1</tr>", "<tr>bla2</tr>", "<tr>bla3</tr>")
so better inspect your input again!
Ah wait ... I think you need an /s modifier to make . match newlines !!!
use strict; use warnings; use Data::Dump qw/pp dd/; my $lsdata = do { local $/;<DATA> }; my @table = $lsdata =~ m/(<tr.*?<\/tr>)/sg; pp @table; __DATA__ <tr>bla1</tr><tr>bla2</tr> <tr>bla3</tr> <tr> bla4 </tr>
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
In reply to Re: Why isn't my global matching regex working? (update: /s modifier)
by LanX
in thread Why isn't my global matching regex working?
by jdseymour
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |