What I am trying to do is extract all tables from the source code and parse the data inside the table. I have been able to successfully do this with the following code.
However if I have 2 or more tables in the source (which is very very common) I only get one single table that encompasses all the tables. It is like it sees the first open html tag and then ignores the rest of the close and opens until it gets to the last close html tag.$Txt =~ s!(<table.*?>)(.*|\n)?(</table>)! my $TD = $2; my $first = $1; my $last = $3; unless ($TD =~ /id="CODE"/) { $TD =~ s#<br>#\n#isg; } "$first$TD$last"!eisg;
For example:
This should parse as three seperate matches but it is only recognized as a single match. I know this has to be a simple thing I am overlooking but just can not see it. Any ideas?<table> <tr><td>First Table</td</tr> </table> <table> <tr><td>Second Table</td</tr> </table> <table> <tr><td>Third Table</td</tr> </table>
In reply to regexp text parsing issue. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |