in reply to Re: A bug in regex with conditional subpattern?
in thread A bug in regex with conditional subpattern?
and simply moves on to the next element.
And that's the bug, IMHO. If the yes-pattern is present, and the condition fails, the whole match normally fails. Why should it move on if the match fails? Compare:
'a' =~ /^xa/ # match of x fails, doesn't move on to match a
When the no-pattern is not present, and the condition fails, it normally doesn't match:
$ perl -wE 'say "a" =~ /^(?(?=b)xxx)a/' $ # no match
So it doesn't show the "move on"-behavior when the yes-pattern is something else than the empty pattern.
So it's a special case. And it's not documented. So it's a bug.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A bug in regex with conditional subpattern?
by ig (Vicar) on Mar 17, 2011 at 18:00 UTC | |
by moritz (Cardinal) on Mar 19, 2011 at 19:16 UTC |