develooper Front page | perl.perl5.porters | Postings from February 2020

Re: Backporting ac3afc4b35 (regcomp.c: make \K+ and \K* illegal.)

Thread Previous | Thread Next
From:
Karl Williamson
Date:
February 11, 2020 17:57
Subject:
Re: Backporting ac3afc4b35 (regcomp.c: make \K+ and \K* illegal.)
Message ID:
598d76fb-1bc6-29b1-35f8-854d66f199e7@khwilliamson.com
On 2/11/20 10:12 AM, hv@crypt.org wrote:
> I thought we were talking about /foo (?:\K+)/, not /(?:foo \K)+/?
> 
> I had assumed that \K only had to (effectively) set a pointer to what
> we're now pretending the match point is, and the second iteration
> of a \K{1,2} would just need to set the pointer to that same thing.
> 
> If that's not the case, it would probably help to have a concrete
> example


We are talking about

/foo\K{m,n}bar/

where 'foo' is arbitrary.  Already {0,0} is optimized to OPFAIL.

The proposal would be to turn any other {0,n} into {0,1}, or more 
concisely '?', and any other {m,n} into {1,1} or simply \K.  (For {1,1}+ 
there would also have to be a non-backtracking marker added)

What should happen if foo contains a code block?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About