View Single Post
  #8 (permalink)  
Old 09-01-2008, 02:24 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,569
Last Blog:
Tidy up your HTML
Credits: 0
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Phone number regexp

This:
Code:
([0-9]{3}-?)
simply groups "three digits and a dash" together. The {1,2} quantifier, says that the "three digits and a dash can occur once or twice."

Using your regular expression this may work
Code:
/[0-9]{3}-[0-9]{3}?-[0-9]{4}/
but I like mine better
Reply With Quote