title: Regular Expression to reformat a US phone number in Javascript
body: <p>I'm looking to reformat (replace, not validate - there are many references for validating) a phone number for display in Javascript. Here's an example of some of the data:</p>
  
  <ul>
  <li>123 4567890</li>
  <li>(123) 456-7890</li>
  <li>(123)456-7890</li>
  <li>123 456 7890</li>
  <li>123.456.7890</li>
  <li>(blank/null)</li>
  <li>1234567890</li>
  </ul>
  
  <p>Is there an easy way to use a regular expression to do this? I'm looking for the best way to do this. Is there a better way?</p>
  
  <p>I want to reformat the number to the following: <code>(123) 456-7890</code></p>