2 Replies - 1394 Views - Last Post: 14 April 2009 - 09:30 AM

#1 Winstinology  Icon User is offline

  • I'm pretty good with a laser mouse..
  • member icon

Reputation: 7
  • View blog
  • Posts: 958
  • Joined: 08-May 08

Valid Phone Number

Posted 08 April 2009 - 12:25 PM

Description: ^[2-9]\d{2}-\d{3}-\d{4}$This Javascript regular expression tests for a valid, 10-digit phone number. (555-555-5555)
^[2-9]d{2}-d{3}-d{4}$

Is This A Good Question/Topic? 0
  • +

Replies To: Valid Phone Number

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2255
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Valid Phone Number

Posted 09 April 2009 - 05:55 AM

I believe that your format is incorrect (at least for North American numbers). It should be NXX-NXX-XXXX according to www.nanpa.com. So it should be:^[2-9]\d{2}-[2-9]\d{2}-\d{4}$
Was This Post Helpful? 0
  • +
  • -

#3 Winstinology  Icon User is offline

  • I'm pretty good with a laser mouse..
  • member icon

Reputation: 7
  • View blog
  • Posts: 958
  • Joined: 08-May 08

Re: Valid Phone Number

Posted 14 April 2009 - 09:30 AM

Mine works fine.. Test it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1