Date: Mon, 24 Sep 2001 16:31:39 -0400 (EDT)
   From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>

   $s = "regex tesT";
   $s =~ /(.)*/;
   print $1;           #prints "T"

   i wish $1 could be an array containing ("r", "e", "g", "e", "x", ... ,
   "T") or better yet, a two dementional array @mem = (["r" ... "T"]). i also
   prefer to work with the positions as upposed to the strings themselves as
   it is much less memory intensive. does anyone know a way to store either
   the string or the positions of all text matching a memory slot as upposed
   to just the last piece?

Not entirely sure this is what you want:

$s = "regex tesT";
@a = $s =~ /(.)/g;
print "@a\n";       #prints "r e g e x   t e s T\n"

I don't see how /(.)*/ would ever get you want you want, unless you
start playing with (?{...}) or similar deep juju.  From outside the
regex, that's only ever going to give you the match for (.) after
the * finishes being greedy.

--kag


Reply via email to