Re: [BUG] [Regex] Is it a bug? Doing /\G(?=\<)/g twice.
by Zefram other posts by this author
Nov 4 2009 6:01AM messages near this date
Re: [BUG] [Regex] Is it a bug? Doing /\G(?=\<)/g twice.
|
[PATCH] Add assertions about there being no leftover scopes when enter perl_destruct.
Shlomi Fish wrote:
> print (($text =~ m{\G(?=<)}cg) ? "True" : "False");
Zero-width match. perlre(1):
# Repeated Patterns Matching a Zero-length Substring
...
# Thus Perl allows such constructs, by forcefully breaking the infinite
# loop. The rules for this are different for lower-level loops given by
# the greedy quantifiers "*+{}", and for higher-level ones like the "/g"
# modifier or split() operator.
#
# The lower-level loops are interrupted (that is, the loop is broken)
# when Perl detects that a repeated expression matched a zero-length
# substring.
...
# Similarly, for repeated "m/()/g" the second-best match is the match at
# the position one notch further in the string.
Not a bug.
-zefram
Thread:
Shlomi Fish
Demerphq
Zefram
|