title: how can i merge phone number validation and formatting number
body: <p>I have this line of code for validation:</p>
  
  <pre><code>var isValidPhone = /^\+?[\d- ]{7,15}$/.test(this.val());
  </code></pre>
  
  <p>And I want to have formatting the number at the same place, something like:</p>
  
  <pre><code>(/(\d{3})\-?(\d{7})/,'$1-$2'))
  </code></pre>
  
  <p>How can I merge them?</p>
  
  <p>I want the phone to be as 0-xxxxxxxxx and the end.</p>