title: regex phone number validation with PHP
body: <p>This is another question about a previous question I had asked <a href="https://stackoverflow.com/questions/18094180/ignore-entered-text-after-a-certain-length-php-jquery-search">yesterday</a>. I want user to be allowed to type US phone numbers in the following formats. </p>
  
  <p>(800)-555-1212</p>
  
  <p>800-555-1212</p>
  
  <p>and have it only check the database for numbers 8005551212</p>
  
  <p>I've seen that regex like 
  <code>/^[\+]?([0-9]*)\s*\(?\s*([0-9]{3})?\s*\)?[\s\-\.]*([0-9]{3})[\s\-\.]*([0-9]{4})[a-zA-Z\s\,\.]*[x\#]*[a-zA-Z\.\s]*([\d]*)/</code></p>
  
  <p>may work but I'm not certain how to implement it into the code from the link I provided</p>
  
  <p>I'm new to php and know nothing about regex. Any help is appreciated.</p>