Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 avoiding work at the Monastery: (14)
As of 2014-10-21 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls