in reply to Regex, how to pull out multiple matches per line into array?

Non capturing groupings
use warnings; use strict; use Data::Dumper; my ( $re, $lin, @g ); my (@inarr) = ( 'stuff{tag}<igo;123>stuff<ig;abc>', '<igt;ddd>stuff blah {foo}', 'stuff blah foo <igxo;dsldkd.eps>', '<igt;aaa>stuff blah <igx;hhh>' ); $re = '<(?:ig|igt|igo|igxo);.+?>'; foreach $lin (@inarr) { @g = ( $lin =~ m/$re/g ); print Dumper( \@g ); } # foreach __END__ $VAR1 = [ '<igo;123>', '<ig;abc>' ]; $VAR1 = [ '<igt;ddd>' ]; $VAR1 = [ '<igxo;dsldkd.eps>' ]; $VAR1 = [ '<igt;aaa>' ];

Replies are listed 'Best First'.
Re^2: Regex, how to pull out multiple matches per line into array?
by bulrush (Scribe) on Aug 04, 2015 at 17:45 UTC
    I read the link you gave and now see what you did. Thanks.