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

Re: Simple Regex

by ilcylic (Scribe)
on Apr 08, 2002 at 17:29 UTC ( #157490=note: print w/replies, xml ) Need Help??


in reply to Simple Regex

Another thing you might want to consider is looking in the string for an "x" somewhere, grabbing the characters after it which include at least one number, up to the first space you see, and moving that whole string (x 534, ext 611, xt9411, etc) to the back of the overall string, in order to ensure that the number string you have left over once you've done your s/\D*/g has the areacode and phonenumber at the beginning.

If you have ext 433 (505)666-7777, you don't want to just strip the non digit chars and substr the first 10 digits as the phone number.

Of course, if you know that the phone numbers always have the extension second (because of the way they were put into the database) then you don't have to worry about it.

Good luck.

-il cylic

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-08-13 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?