title: Phone number regular expressions exact format
body: <p>I'm looking for a regular expression that will match any of these phone number formats but ONLY these formats. For example, (999-999-999 should not work. I know how to use ? for optional however I want the second ) to be mandatory only if the number starts with (, and the second ) should not be optional if the number does not start with a (. Also wherever there is a black space, there could be an unlimited number of spaces. (999)  999-999 is valid but (999   ) 999-9999 is not</p>
  
  <pre><code>999-999-9999
  999 999 9999
  999 999-9999
  9999999999
  999 9999999
  (999) 999-9999
  (999) 999 9999
  </code></pre>