Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Trim Phone Numbers

by bv (Friar)
on Dec 15, 2009 at 04:20 UTC ( #812810=note: print w/replies, xml ) Need Help??


in reply to Trim Phone Numbers

perl -lnpe 's/.*(?=\d{3}-?\d{4}$)/*/'

or another interpretation of your question:

perl -lnpe 's/(\d\d-?)(\d{3}-?)(?=\d{3}-?\d{4}$)/$1=~tr!0-9!*!;$2=~tr!0-9!*!;$1.$2/e

@_=qw; Just another Perl hacker,; ;$_=q=print "@_"= and eval;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-02-25 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (108 votes). Check out past polls.

    Notices?