title: Javascript RegExp: Word boundaries and punctuation marks
body: <p>Im trying to use javascript's RegExp to match full words but it doesn't work when those words have punctuation as the boundary. I.e. </p>
  
  <pre><code>(new RegExp("\\b"+RegExp.escape("why not")+"\\b", 'i')).test("why not you foolish")
  </code></pre>
  
  <p>Correctly matches. And: </p>
  
  <pre><code>(new RegExp("\\b"+RegExp.escape("why not")+"\\b", 'i')).test("why nots you foolish")
  </code></pre>
  
  <p>Correctly does not match. The problem is this doesn't work when the word ends with a "?":</p>
  
  <pre><code>(new RegExp("\\b"+RegExp.escape("why not?")+"\\b", 'i')).test("why not? you foolish") 
  </code></pre>
  
  <p>Any suggestions? </p>
  
  <p>NOTE: I am using this function to escape:</p>
  
  <pre><code># Escape characters for regexp
  RegExp.escape = (text) -&gt;
    text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&amp;")
  </code></pre>