Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Regex capture consumed by non-capturing match

by ribasushi (Monk)
on Jul 20, 2007 at 15:55 UTC ( #627817=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Regex capture consumed by non-capturing match
in thread Regex capture consumed by non-capturing match

Yes, except that it is quite hard to write an if that checks if the match succeeded at all. I omitted this in the example, but in the real code this was the case:

if ($string =~ /re/) { my ($a, $b, $c) = trim_func ($1, $2, $3); }


Comment on Re^3: Regex capture consumed by non-capturing match
Download Code
Re^4: Regex capture consumed by non-capturing match
by ikegami (Pope) on Jul 20, 2007 at 16:29 UTC

    Not so.

    if (my @matches = $string =~ /re/) { my ($a, $b, $c) = trim_func(@matches); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-03 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls