sh1tn has asked for the wisdom of the Perl Monks concerning the following question:
But in fact:The lower-level loops are interrupted (that is, the loop is broken) wh +en Perl detects that a repeated expression matched a zero-length subs +tring. Thus: m{ (?: NON_ZERO_LENGTH | ZERO_LENGTH )* }x; is made equivalent to m{ (?: NON_ZERO_LENGTH )* | (?: ZERO_LENGTH )? }x;
My question - is this behaviour expected? Thank you for the help!$_ = 'aaabbb'; /((?: a | c? )*)/x; # 'c' matches once with zero-length # which is not the same as /(( a )* | ( c? )?)/x; # where 'c' does not match at all
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ZERO_LENGTH match
by hv (Prior) on Aug 01, 2005 at 16:15 UTC | |
by Anonymous Monk on Aug 01, 2005 at 17:01 UTC | |
by hv (Prior) on Aug 02, 2005 at 01:15 UTC | |
by Anonymous Monk on Aug 01, 2005 at 17:16 UTC | |
by fro (Novice) on Aug 02, 2005 at 08:09 UTC | |
|
Re: ZERO_LENGTH match
by Anonymous Monk on Aug 01, 2005 at 15:26 UTC | |
by sh1tn (Priest) on Aug 01, 2005 at 15:52 UTC |