Regular expression with lookahead does not match, while it should. #13954
Comments
From dietmar.schindler@manroland-web.comThis is a bug report for perl from dietmar.schindler@manroland-web.com, I observed the following bug in Perl versions 5.10.1, 5.18.2 and 5.20.0, while Flags: Site configuration information for perl 5.20.0: Configured by strawberry-perl at Fri May 30 08:28:40 2014. Summary of my perl5 (revision 5 version 20 subversion 0) configuration: Platform: @INC for perl 5.20.0: Environment for perl 5.20.0: Confidentiality note: ! Please consider your environmental responsibility before printing this eMail ! |
From @jkeenanOn Tue Jun 24 00:45:27 2014, dietmar.schindler@manroland-web.com wrote:
I don't believe this is a bug in Perl 5. According to 'perldoc perlre' in blead: "(?=pattern)" is used as "A zero-width positive look-ahead assertion." If we are to look ahead, we have to have something in the pattern *from which we are looking ahead*. I don't see anything like that in your pattern. Did you perhaps want a positive look-behind pattern "(?<=pattern)"? Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From Eirik-Berg.Hanssen@allverden.noOn Tue, Jun 24, 2014 at 10:52 PM, James E Keenan via RT <
Huh? It's supposed to be looking ahead from the starting position, which $ perl -wE '"foo bar" =~ /(?=[bo])(?{ say pos })(?!)/' Observe also: $ perl -E 'say " P" =~ /(?=P)P/' $ Why shouldn't .* match the empty string? I'm pretty sure this is a Eirik |
From @khwilliamsonOn 06/24/2014 03:39 PM, Eirik Berg Hanssen wrote:
The commit that changed the behavior from the original to the current Re: [PATCH] Better version of the Aho-Corasick patch and lots of (with tweaks) |
From @demerphqOn 25 June 2014 00:28, Karl Williamson <public@khwilliamson.com> wrote:
That surprises me given this: $ ./perl -Ilib -Mre=debug -le'" P" =~ /(?=.*P)P/' Why did it decide it is anchored? It shouldn't have decided that. If you bisected maybe this is a false positive. Yves -- |
From @demerphqOn 25 June 2014 08:36, demerphq <demerphq@gmail.com> wrote:
Anyway, it is clearly the optimiser going wrong, as you can see below. If I find some time to debug further I will let you know what I find. Yves $ ./perl -Ilib -Mre=Debug,ALL -le'" P" =~ /(?=.*P)P/'
-- |
From @demerphqOn 25 June 2014 08:43, demerphq <demerphq@gmail.com> wrote:
I pushed a fix. Since I am "retired" right now I did not push tests. Yves -- |
From @wolfsageOn Wed, Jun 25, 2014 at 3:33 AM, demerphq <demerphq@gmail.com> wrote:
Thanks. I've added a small test case in 06ab3c1. More would be good though. -- Matthew Horsfall (alh) |
From @khwilliamsonFixed by c445c5b |
@khwilliamson - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122171 (status was 'resolved')
Searchable as RT122171$
The text was updated successfully, but these errors were encountered: