Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How do I break down a phone number and rebuild it?

by jcwren (Prior)
on Jul 11, 2000 at 19:20 UTC ( [id://21996]=note: print w/replies, xml ) Need Help??


in reply to How do I parse a telephone number?

Based on jlistf's answer:

( undef, $areacode, $exchange, $line ) = $phn =~ m|(1-)?\(?(\d{3})\)?-?(\d{3})-(\d{4})|;
Works on strings such as the following:
212-555-1212 (212)555-1213 1-(212)-555-1214 1-212-555-1215

Originally posted as a Categorized Answer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found