Phoenix.pm: Regex question
Doug Miles
doug.miles at bpxinternet.com
Fri Feb 2 17:08:56 CST 2001
Scott Walters wrote:
>
> Doug,
>
> |DailyNAV|Class C|||nav <-- output of your version
> ||DailyNAV| |Class C|| ||nav <-- output of same regex used in split() on same string
>
> Regex can match 0 character things, like with split //, $str;... but looking
> at the regex, nothing in there would match something 0 chracters long, so
> I don't know =)
Yeah, I had the same line of thought.
> Hmm. Tried a few other regexes that also "should work" and had no luck. Only
> thing I can think of is work around the mystery/problem:
>
> my @tokens = grep { $_ ? 1 : 0 } $string =~ /"([^"]+)"|(\S+)/g;
Thanks for the reply. I might just have to do the grep thing. If I
ever figure it out, I'll post to the list... Anyone else?
--
- Doug
Encrypted with ROT-26 - all attempts to decrypt are illegal under the
DMCA!
More information about the Phoenix-pm
mailing list