in reply to Why isn't my global matching regex working?
As I understand it, this will extract all <tr> blocks from my input.
Since you have not provided that input, we can only guess. Looking at How to ask better questions using Test::More and sample data it is simple enough to come up with a demonstration which shows that regex to work for a given set of input. Note that like brother LanX I'm going to get rid of all those backslashes.
use strict; use warnings; use Test::More tests => 4; my $input = '<html><tr>foo</tr><tr>bar</tr><tr>baz</tr></html>'; my @table = $input =~ m#(<tr.*?</tr>)#g; is $#table, 2; is $table[0], '<tr>foo</tr>'; is $table[1], '<tr>bar</tr>'; is $table[2], '<tr>baz</tr>';
|
|---|