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

[perl #18268] (a|b)* cant match a string larger than 2**15-1 chars long.

Thread Previous
From:
Shlomi Fish via RT
Date:
February 28, 2015 08:10
Subject:
[perl #18268] (a|b)* cant match a string larger than 2**15-1 chars long.
Message ID:
rt-4.0.18-11587-1425111041-925.18268-15-0@perl.org
On Fri Feb 27 12:08:26 2015, jkeenan wrote:
> On Sat Jul 27 00:03:28 2013, sprout wrote:
> > On Sun Oct 14 16:06:33 2012, hv wrote:
> > > It is fixable, and I believe eventually it'll have to be fixed - as
> > > computational power and size of typical strings increases, it is a
> > > constraint that will seem increasingly restrictive.
> > >
> > > I just don't know (quite) how, or when.
> >
> > Hopefully soon.
> >
> > I’m trying to write tests for perl’s anchored string optimisation
> > with
> > large strings.  But I’m having to write things like this:
> >
> > (?:(?:.{32766}){32766}){2}(?:.{32766}){8}.{8}
> >
> > This is a bit annoying. :-)
> >
> 
> Has anyone been able to make any progress on this issue?
> 
> In 5.20.1:
> 
> #####
> $ perl -wle '$_="x" . ("a" x (2 ** 15 - 1)) . "y"; print (/x(bc|a)*y/
> ? "yes" : "no");'
> Complex regular subexpression recursion limit (32766) exceeded at -e
> line 1.
> yes
> 
> $ perl -wle '$_="x" . ("a" x (2 ** 15    )) . "y"; print (/x(bc|a)*y/
> ? "yes" : "no");'
> Complex regular subexpression recursion limit (32766) exceeded at -e
> line 1.
> #####

I should note that it also happens with a non-capturing group:

<SHELL>

shlomif@telaviv1:~$ perl -wle '$_="x" . ("a" x (2 ** 15 -1   )) . "y"; print (/x(?:bc|a)*y/ ? "yes" : "no");'
Complex regular subexpression recursion limit (32766) exceeded at -e line 1.
yes
shlomif@telaviv1:~$ perl -wle '$_="x" . ("a" x (2 ** 15   )) . "y"; print (/x(?:bc|a)*y/ ? "yes" : "no");'
Complex regular subexpression recursion limit (32766) exceeded at -e line 1.
no
shlomif@telaviv1:~$ 


</SHELL>

Regards,

-- Shlomi Fish

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=18268

Thread Previous


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