On Mon, 24 Sep 2001, Greg London wrote:

> "[EMAIL PROTECTED]" wrote:
> 
> > the memory variables $1 - $9 i think are odd. 
> 
> Yeah, me too. you can use regular expressions
> in list context to capture the matches though:
> 
> my @matches = $str=~/(patt)(patt2)(patt3)/;
> 
> the only caveat is that this will NOT update
> the \G anchor or the value returned by pos($str).
> 
> I filed a perlbug on this, but claims that this
> would break backward compatibility were given
> as a reason to not change this 'feature'.
> 
> what I ended up doing was 
> doing the regular expression in array context,
> and then creating a string in a for loop
>       push(@matches, $1);
> where "$1" was the match variable I wanted,
> and then doing an eval on the string.
> 
> If you don't need \G, then just use the regexp
> in list context though.

i don't know what \G is :)
but using the regex in the list context, though cooler that the $1 vars
and solves the annoyance i had with perl regex memory, it still does not
solve the problem of multiple $1's still only being outputed as the last
$1. eg:

  $text = "111222333";
  @mem = $text =~ /(1)+(2)+(3)+/;
  #@mem now eqals ("1", "2", "3"),
  #not (["1","1","1"],["2","2","2"],["3","3","3"])
  #which is what i wish and think it should be
 
> Greg
> 

Reply via email to