title: Validating Contact Numbers using JQuery Validation
body: <p>I am trying to validate whether user is entering mobile number correctly.
  For this I have written the following regex which seems to be buggy.
  Mobile number can <strong>Optionally</strong> start with <strong>+</strong> can have  <strong>Optional spaces, round brackets, hyphens ( - )</strong>.
  It cannot contain any <strong>alphabets</strong> or <strong>any other character</strong>.</p>
  
  <pre><code>jQuery.validator.addMethod("mobileNumber", function(value,element) {
              return this.optional(element) ||  /(?:([+]))?[0-9]*/.test(value);
  }, "Please enter a valid Contact Number");
  </code></pre>
  
  <p>Following inputs should match,</p>
  
  <blockquote>
    <p>+1-222</p>
    
    <p>(+1) 222</p>
    
    <p>+1222</p>
    
    <p>2222</p>
    
    <p>02-222</p>
  </blockquote>
  
  <p>But these shouldn't match.</p>
  
  <blockquote>
    <p>1+222 </p>
    
    <p>AAA</p>
    
    <p>AA12</p>
    
    <p>2.2.2</p>
  </blockquote>
  
  <p>How should I write the regex for above criteria?</p>
  
  <p>Thanks.</p>