-
Notifications
You must be signed in to change notification settings - Fork 578
problem with simple regular expression matching #7464
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
Comments
From @johanngeorgeA simple regular expression match is failing. The following short program #!/usr/bin/env perl my $s = "Hello"; # uncomment out next line and match succeeds. Flags: Site configuration information for perl v5.8.0: Configured by bhcompile at Tue Feb 18 22:17:47 EST 2003. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Locally applied patches: @INC for perl v5.8.0: Environment for perl v5.8.0: |
From @JohnPeacockJohann George (via RT) wrote:
Setting pos() while using //g is definitely double uncool (even though you are
Running the code without the assignment with the added line: use re 'debug'; displays this:
but I'm not at all sure where the "requested=1" is coming from. FWIW, this HTH John -- |
The RT System itself - Status changed from 'new' to 'open' |
From [email protected]John Peacock <jpeacock@rowman.com> writes:
Presumably this is a fix for zero width matching in same place multiple times. So while (/\GZ*/g) { ... } doesn't loop forever.
|
From @ysthOn Sun, Aug 15, 2004 at 01:21:23PM +0100, Nick Ing-Simmons <nick@ing-simmons.net> wrote:
And is documented in perlre "Repeated patterns matching zero-length substring". |
From @tamiasOn Sun, Aug 15, 2004 at 08:16:21AM -0400, John Peacock wrote:
What?! That's the whole point of pos() being an lvalue; you can set it See the perlre documentation, "Repeated patterns matching zero-length Ronald |
From @JohnPeacockRonald J Kimball wrote:
Sorry, I should have been a little less broad with my brush. Setting pos()
Yes, that explains it quite fine, as others have already pointed out. I was at John -- |
From [email protected]On Aug 16, John Peacock said:
If the docs don't state that \G is just an anchor that only matches at the It might make you sick to know that $_ = "japhy"; works and prints "ap". -- |
From @JohnPeacockJeff 'japhy' Pinyan wrote:
Patches welcome! ;)
Please keep your perversions to yourself in this public forum. :0 John -- |
@iabyn - Status changed from 'open' to 'resolved' |
From @johanngeorgeI am most impressed with your responsiveness. Thank you all for your The higher level-loops preserve an additional state between I have been using $str =~ /\G ... /g; pos($str) = pos($str) after every attempted match that might be zero-length. I gather that it Thanks much. Johann |
From @JohnPeacockJohann George wrote:
As long as you don't do this in a while() loop, you should be fine. John -- |
From [email protected]Johann George <johann@georgex.org> writes:
In context of perl regexps yes.
Don't think so. |
Migrated from rt.perl.org#31129 (status was 'resolved')
Searchable as RT31129$
The text was updated successfully, but these errors were encountered: