title: Javascript Regex - 9-digit number
body: <p>I am trying to validate a variable contains a 9-digit number in Javascript.  This should be basic but for some reason this is failing:</p>
  
  <pre><code>    var test = "123123123";
      var pattern = new RegExp("/\d{9}/");
  
      if(test.match(pattern))
      {
          //This code never executes
      }
      else
      {
          //This code is always executing
          alert('no match!'); 
      }
  </code></pre>
  
  <p>Can anyone see why I am not getting a match?  </p>
  
  <p>I also tried type-casting test to an integer with:</p>
  
  <pre><code>test = Number(test);
  </code></pre>
  
  <p>...but this doesn't work as it has to be a String to support the .match method.</p>