Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Simple Regex

by jwest (Friar)
on Apr 08, 2002 at 17:19 UTC ( #157488=note: print w/ replies, xml ) Need Help??


in reply to Simple Regex

One way to do it is to eliminate all of your problem characters first. This way, you won't have to think through a more complex RE:

s/\D//g; /(\d{10})(\d*)/;

Of course, this assumes that all phone numbers have the correct numbers in all the right places (three digit area code, seven digit number, and possibly an extension). It'll probably be right for a good number of rows, but the only way to be sure is to eyeball the output and compare it.

Hope this helps!

--jwest

-><- -><- -><- -><- -><-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7


Comment on Re: Simple Regex
Download Code
Re: Re: Simple Regex
by tjh (Curate) on Apr 08, 2002 at 17:32 UTC
    And then there are the local versions of non-U.S. numbers, and the long distance versions of dialing them... Unless the application is itself going to be involved in dialing, it may be permissible to leave them as is, and suggest database users to edit/correct the fields on subsequent viewings on the fly.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-09-15 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls