Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re2: Simple Regex

by dragonchild (Archbishop)
on Apr 08, 2002 at 17:16 UTC ( [id://157487]=note: print w/replies, xml ) Need Help??


in reply to Re: Simple Regex
in thread Simple Regex

Good solution, cutting to the chase.

However, you still have to worry about malformations, such as phone numbers that aren't 7 or 10 digits. Often times, people will want to have the area code somewhere else, too. *shrugs*

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Re2: Simple Regex
by Juerd (Abbot) on Apr 08, 2002 at 17:33 UTC

    However, you still have to worry about malformations, such as phone numbers that aren't 7 or 10 digits.

    So every database has numbers only within a single country? Not like any database I've ever used. I even thought about not filtering out leading plusses, but didn't do so, because I think this was homework anyway - and there should still be a challenge.

    As for 7 or 10 digits, I had no idea about how other countries have their telephone numbers, and think I should not guess.

    The fix: check length.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

      Juerd you're showing your europeanism... :-)

      So every database has numbers only within a single country? Not like any database I've ever used.

      Dont forget that ALL of North America (and the Bahamas) uses the same country code (1) and even more unlike Europe they use a standardized number format (3-3-4) _and_ they use extensions (which Germany for example does not).

      I even thought about not filtering out leading plusses

      Most North Americans dont know what the plus would mean anyway. (heh)

      The fix: check length.

      Unfortunately that doesnt work, the extension can be practically any number you like...

      Now you know how I felt when I first got to Europe... Confused. (And lets not even talk about different dial tones and signals, I still get confused sometimes if it ringing or not....)

      :-)

      Yves / DeMerphq
      ---
      Writing a good benchmark isnt as easy as it might look.

        Dont forget that ALL of North America (and the Bahamas) uses the same country code (1) and even more unlike Europe they use a standardized number format (3-3-4) _and_ they use extensions (which Germany for example does not).

        Do you imply that Americans never dial numbers outside of their +1 area?

        U28geW91IGNhbiBhbGwgcm90MTMgY
        W5kIHBhY2soKS4gQnV0IGRvIHlvdS
        ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
        geW91IHNlZSBpdD8gIC0tIEp1ZXJk
        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found