[Phoenix-pm] Fwd: Re: A christmas wish: simple notation for ratcheting (non-backtrack) regex
Scott Walters
scott at illogics.org
Tue Dec 26 10:35:28 PST 2006
Hi all,
In Perl 5.10, + in a pattern after another qualifier means "don't back up past
this point if you've matched this much". Yay =)
-scott
----- Forwarded message from Rafael Garcia-Suarez <rgarciasuarez at gmail.com> -----
From: Rafael Garcia-Suarez <rgarciasuarez at gmail.com>
To: "Randal L. Schwartz" <merlyn at stonehenge.com>
Subject: Re: A christmas wish: simple notation for ratcheting (non-backtrack) regex
On 25 Dec 2006 21:39:29 -0800, Randal L. Schwartz <merlyn at stonehenge.com>
wrote:
>>>>>> "mark" == mark <mark at mark.mielke.cc> writes:
>
>mark> Are you asking for the same thing as the Java "possessive
>quantifiers"?
>mark> They use "+" to mean this already.
>
>Yeah, OK. I didn't think I was totally making this up. :)
>
>But it's even more interesting if it's to be compatible with other
>regex engines. Cool.
bleadperl has possessive quantifiers, thanks to Yves.
>From perlre:
Possessive quantifiers are equivalent to putting the item they are applied
to inside of one of these constructs. The following equivalences apply:
Quantifier Form Bracketing Form
--------------- ---------------
PAT*+ (?>PAT*)
PAT++ (?>PAT+)
PAT?+ (?>PAT?)
PAT{min,max}+ (?>PAT{min,max})
----- End forwarded message -----
More information about the Phoenix-pm
mailing list