title: What's a simple RegEx for a 10 digit phone number with or without an extension?
body: <p>A valid phone number is 10 digits, delimited by a dash, and may contain an optional 1-6 digit extension in the format of " x 123456" or " x 123". The following examples would be valid numbers.</p>
  
  <p>123-456-7890
  123-456-7890 x 123
  123-456-7890 x 1234</p>
  
  <p>The following RegEx works for a 10 digit phone number: <code>/[0-9]{3}-[0-9]{3}-[0-9]{4}/</code>, however when I attempted to add the optional extension like <code>/[0-9]{3}-[0-9]{3}-[0-9]{4}( x [0-9]{1,6})?/</code> it broke.</p>
  
  <p>Does anyone know what's wrong?</p>