Phoenix.pm: Regex question
whitneyt at agcs.com
Fri Feb 2 20:10:17 CST 2001
my @list = $string =~ /(".*?"|\S+)/g;
I think it is faster without the non greedy though?
What is happening with /"([^"]+)"/g; How does this work?
What about with escapes?
my $string = 'DailyNAV "Print \"C\"" nav';
my @list = $string =~ /("(?:\\"|.)*?"|\S+)/g;
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*
> Mike D.
More information about the Phoenix-pm