Regex question

Doug Miles doug.miles at
Mon Feb 5 14:02:55 CST 2001

Michael Dearman wrote:
> Love a good regex mystery. This one still just that.
> Using the no-paren-mem operater  with your last regex appears to do away with the nulls.
> my @tokens = $string =~ /"(?:[^"]+)"|(?:\S+)/g;
> Why? *shrug*

I think that it is because of the default regex behavior to return a
match.  If I specify what I want with normal parens, I force it to
return a $1 and a $2.  See my other explanation for more info.  The
other thing is that this returns the quotes, which I didn't want to do. 

- Doug

Encrypted with ROT-26 - all attempts to decrypt are illegal under the

More information about the Phoenix-pm mailing list