Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: perl look ahead regular expression that is optional?

by Skeeve (Vicar)
on Oct 03, 2013 at 21:11 UTC ( #1056800=note: print w/ replies, xml ) Need Help??


in reply to perl look ahead regular expression that is optional?

Do you see where this contradicts?

compare: The second set of characters is always preceded by an X (...) and might contain (...) Only zero or one a, zero or one b, and zero or one c is (...)

to: foobarabcX must not match, nothing follows 'X'

I think it must match as X is followed by exactly zero "a"s, "b"s and "c"s.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e


Comment on Re: perl look ahead regular expression that is optional?
Select or Download Code
Re^2: perl look ahead regular expression that is optional?
by bigsipper (Initiate) on Oct 04, 2013 at 00:54 UTC
    Yes, you are correct - as written it could be interpreted to mean that zero or more characters after the 'X' are allowed. My write up of the problem was in error. If there are ANY flags in the second set of characters, there is a 'X' preceding them. It is illegal to have an 'X' without a following character. The basics are correct, though. I have two optional sets of flags (single characters) that I need to parse out into separate variables. By the way... have tried to simplify the problem. I am trying to parse a much more complicated string set.
Re^2: perl look ahead regular expression that is optional?
by talexb (Canon) on Oct 04, 2013 at 13:34 UTC
      I think it must match as X is followed by exactly zero "a"s, "b"s and "c"s.

    My point exactly. I'm glad I'm not the only one who was confused by this inconsistency.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-09-23 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (217 votes), past polls