Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Repeating regex assign to a list

by iang (Sexton)
on Mar 04, 2016 at 18:49 UTC ( [id://1156841]=note: print w/replies, xml ) Need Help??


in reply to Re: Repeating regex assign to a list
in thread Repeating regex assign to a list

It is exactly what I was looking for, only I was trying to be a bit clever (or not) and wanted to shorten it into a single REGEX. --- thank you for your reply

Replies are listed 'Best First'.
Re^3: Repeating regex assign to a list
by AnomalousMonk (Archbishop) on Mar 04, 2016 at 20:11 UTC

    Tanktalus's split approach is probably better, but here's a "clever (or not) ... single regex" that produces the same output:

    c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "use 5.010; ;; my $s = 'aaa bbb ccc dd ee ff dd TAG=lls foo TAG=some randome tag TAG +=last_tag'; ;; my @ra = $s =~ m{ TAG \s* = \K (?: (?! \s* TAG) .)* }xmsg; dd \@ra; " ["lls foo", "some randome tag", "last_tag"]
    (Needs 5.10+ for the  \K regex operator.)


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found