New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/o regexes spreading beyond scope #10759
Comments
From yegg@flash.duckduckgo.comCreated by yegg@flash.duckduckgo.comTest case: my @strings = ('testing','','testing','testing'); foreach my $string (@strings) { print "\nSTRING: $string\n"; my $string2 = 'http'; my $q = $string; Here's what I think is happening. If you have a an /o regex with a capture clause and it captures something, and then you run a a second regex with a variable, but it set to '', then it uses the first compiled regex instead and doesn't match as you'd expect. In this example, You'd expect line 14 to warn 1 then nothing, then 1 twice. Instead, you get 1, then nothing the rest of the time. Perl Info
|
From @ask
I get 1, undef, 1, 1 as expected with 5.12.2 and the Apple provided 5.10.0 and 5.8.9 on OS X. |
The RT System itself - Status changed from 'new' to 'open' |
From yegg@alum.mit.eduOn Mon Oct 25 11:04:59 2010, ask wrote:
Here's someone else with 5.12.2 that confirms the bug: |
From @ikegamiAs explained on PerlMonks, that is the documented behaviour of the empty $ perl -E'say "a" =~ /(.)/; say "b" =~ //; say "c" =~ /\Q\E/; say "d" =~ The last shows a possible workaround if you want to an empty pattern to Now, you might say \Q and \E are there, so it's not empty. \Q and \E are Does that qualify as a bug? Perhaps, so I'm not rejecting. |
From @pjcjOn Mon, Oct 25, 2010 at 10:03:27AM -0700, yegg@flash.duckduckgo.com wrote:
The behaviour here seems to depend on whether or not usethreads is defined. -- |
From @ikegamiOn Mon Oct 25 17:24:02 2010, ikegami@adaelis.com wrote:
I withdraw what I said. While true, it has nothing to do with the bug |
I ran 5.35.10 unthreaded and threaded and got identical results: `STRING: testing STRING: STRING: testing STRING: testing |
Yes, it was fixed by 3cb4cde as part of 5.28. Closing. |
Migrated from rt.perl.org#78564 (status was 'open')
Searchable as RT78564$
The text was updated successfully, but these errors were encountered: