Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

sed equivalent in perl

by mhooper (Novice)
on Mar 07, 2017 at 17:28 UTC ( [id://1183852]=perlquestion: print w/replies, xml ) Need Help??

mhooper has asked for the wisdom of the Perl Monks concerning the following question:

newbie to Perl I'm trying to convert an existing sed replacement into a perl field substitution sed -r "s/(.*<sip:)(.*)(@.*)/\2/g" trying to get output of only the value between <sip: and @ for parsing out phone data in field such as "My Name <sip:+15555551212@192.168.0.200" and all I want out is +15555551212. thank you Murray

Replies are listed 'Best First'.
Re: sed equivalent in perl
by Anonymous Monk on Mar 07, 2017 at 17:52 UTC
    my $str ='My Name <sip:+15555551212@192.168.0.200'; (my $val) = $str =~ /:([^\@]+)/; print "$val\n";
      Thank you

Log In?
Username:
Password:

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

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

    No recent polls found