Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Is there another way to get named captures

by AlexP (Pilgrim)
on Jan 10, 2022 at 13:22 UTC ( [id://11140321]=note: print w/replies, xml ) Need Help??


in reply to Is there another way to get named captures

So I decided to create a package to serve my needs. It's creates isolated level from %+, %-. https://metacpan.org/pod/Regex::Object

  • Comment on Re: Is there another way to get named captures

Replies are listed 'Best First'.
Re^2: Is there another way to get named captures
by Corion (Patriarch) on Jan 10, 2022 at 13:31 UTC

    Thanks for writing this!

    Personally, I think there could be a small enhancement, to be able to also create match objects without needing the regular expression, like:

    my $string = 'foo foo fooo'; while( $string =~ /(fo+)/g) { my $match = Regex::Object->collect(); push @matches, $match; }

    That way, the collecting of the match data is available even when I'm not running a plain match.

      Great idea! I'll think about implementation!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140321]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-18 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found