Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Need regexp to pick off second parenthetical item

by tybalt89 (Monsignor)
on Mar 26, 2017 at 01:05 UTC ( [id://1185971]=note: print w/replies, xml ) Need Help??


in reply to Need regexp to pick off second parenthetical item

#!/usr/bin/perl # http://perlmonks.org/?node_id=1185969 use strict; use warnings; my $sentto = 'Fred Flintstone (US) (fredf@gmail.com)'; $sentto =~ m/.+\K\(.*/; print "First: $`\nSecond: $&\n"

Replies are listed 'Best First'.
Re^2: Need regexp to pick off second parenthetical item
by cormanaz (Deacon) on Mar 26, 2017 at 15:10 UTC
    Awesome. I didn't know about \K.

      Regex operator  \K is only available from Perl version 5.10 onward.


      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://1185971]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found