title: Uncaught SyntaxError: Invalid flags supplied to RegExp constructor '\b'
body: <p>I am attempting to search a string for a specific word ('cow') using the following:</p>
  
  <pre><code>var regex = new RegExp('cow', '\\b');
  </code></pre>
  
  <p>I only wish to target 'cow' and not words which contain 'cow' such as 'cowboy' or 'cows' using the '\b' expression, however this results in:</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Invalid flags supplied to RegExp constructor
    '\b'</p>
  </blockquote>
  
  <p>I have attempted to use 'b', '\b', '/\b' but all result in the same error.</p>
  
  <p>What is the correct expression I need to use?</p>