my @data = ( 'Line1 > > ', 'Line2 error 1 1 > ', ); # The single match on Line2 is correct, # but I am only getting one match from Line1. # When I work the pattern by hand, # I see that it should match twice on Line2. # How can I get the second match? foreach my $test (@data) { if ($test =~ /(<[a-z]{4,5}\s\d\s\d\s<[^>]+?>\s<[^>]+?>>)/gx ) { print "Found '$1' in line '$test'\n"; } }