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
Accessing captures from another capture fails a match #6536
Comments
From @zoffixznetIRC: https://irclog.perlgeek.de/perl6/2017-09-18#i_15181575 We can use $0 here to refer to previous capture and regex matches: But if we capture that match, the match fails: |
From @smlsOn Mon, 18 Sep 2017 09:00:54 -0700, cpan@zoffix.com wrote:
Not a bug. Each `( )` capture represents a subpattern¹ that builds its own Match object, and inside the subpattern, `$/` refers to this subpattern's Match (which in your case doesn't have any captures) and not to the parent pattern's Match (which has the capture you meant to access). I don't think there's a built-in way to access a parent pattern's Match object - you'll have to manually pass on the object in a variable or similar, like you already discovered in the linked IRC log. This ticket can IMO be closed as 'rejected', but I'll leave it open for now in case I missed something obvious or in case you want to turn it into an RFC or similar. |
|
The RT System itself - Status changed from 'new' to 'open' |
|
@zoffixznet - Status changed from 'open' to 'rejected' |
From @zoffixznetOn Mon, 18 Sep 2017 09:46:50 -0700, smls75@gmail.com wrote:
I just didn't know of this feature. Thanks for clarifying. Rejecting |
Migrated from rt.perl.org#132120 (status was 'rejected')
Searchable as RT132120$
The text was updated successfully, but these errors were encountered: