in reply to Re: Matching and making accesible an arbitrary number of subpatterns w/a regex?
in thread Matching and making accesible an arbitrary number of subpatterns w/a regex?

That does not work when the string doesn't contain any colon:

my $src_string = 'aaa'; my @results = $src_string =~ /([^:]*):/g; use Data::Dumper; print Dumper \@results; __END__ $VAR1 = [];

--
David Serrano

  • Comment on Re^2: Matching and making accesible an arbitrary number of subpatterns w/a regex?
  • Download Code

Replies are listed 'Best First'.
Re^3: Matching and making accesible an arbitrary number of subpatterns w/a regex?
by ikegami (Patriarch) on Aug 03, 2006 at 17:43 UTC
    It seems to me from the OP's description that it will always end in a semi-colon. If not, add it:
    my $src_string = 'aaa:bbb:ccc:ddd:eee'; my @results = "$src_string:" =~ /([^:]*):/g;