title: Regexp equivalence
body: <p>I'm trying to write a regular expression that achieves the same result as <code>grep -w</code>.  </p>
  
  <p>What I have come up for now is:</p>
  
  <pre><code>var regex = /([^\w]|^)word_to_search([^\w]|$)/;
  </code></pre>
  
  <p>and it seems to work correctly.</p>
  
  <p>Is there a "better" solution that you are aware of?</p>