c has asked for the wisdom of the Perl Monks concerning the following question:
My regex is as follows:
/C(?:800)|(?:(?:35|29)(?:(?:50)|(?:00XL)))/
Concerning this snippet of code, I have two questions...
1. Is this using too many paren statements, or is this just per coder's discretion?
2. This regex matches on 'C3550XL' and I'm not sure why. I would expect C3500XL or C3550, but not this problematic mix of the two. My thought is that the statement:
(?:(?:50)|(?:00XL))
seperates the 50 and the XL portion ensuring a match only on strings with XL that are directly preceeded by two zeros.
Thanks in advance for you guidance.
-c
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: A question of 'or' in a Regex
by broquaint (Abbot) on May 28, 2003 at 14:55 UTC | |
by diotalevi (Canon) on May 28, 2003 at 15:26 UTC | |
Re: A question of 'or' in a Regex
by BrowserUk (Patriarch) on May 28, 2003 at 15:58 UTC |
Back to
Seekers of Perl Wisdom