in reply to A bug in regex with conditional subpattern?
The condition (?=b) must return false.
It does. The condition returns false, therefore it make no attempt to match the (null) yes pattern (which would have matched anyway), and simply moves on to the next element 'a$', which matches.
In other words, if the condition of the conditional expression, in this case the lookahead assertion, is false, then no attempt is made to use either the yes pattern, or the no pattern (here missing). In effect, the entire construct becomes a noop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A bug in regex with conditional subpattern?
by moritz (Cardinal) on Mar 17, 2011 at 10:43 UTC | |
by ig (Vicar) on Mar 17, 2011 at 18:00 UTC | |
by moritz (Cardinal) on Mar 19, 2011 at 19:16 UTC | |
|
Re^2: A bug in regex with conditional subpattern?
by jethro (Monsignor) on Mar 17, 2011 at 10:38 UTC |