title: Specialised RegEx not working in Jquery
body: <p>I want to match certain numbers from the page and the regex I created is <code>/^(0 ?){1}([1-8] ?){1}(\d ?){9}$/</code> and it works fine in online regex tester tool. However, when I put it in my javascript function for some reason the regex matching with <code>^</code> &amp; <code>$</code> is not working in my code.</p>
  
  <pre><code>var regex = /^(0 ?){1}([1-8] ?){1}(\d ?){9}$/; 
  var text = $("body:first").html();
  text = text.replace(regex, "&lt;a href=\"tel:$&amp;\"&gt;$&amp;&lt;/a&gt;");
  
  $("body:first").html(text);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/PShYy/50/" rel="nofollow">Example at JSFiddle</a></p>