title: Whole word search in javascript using regex
body: <p>I'm trying to perform a whole word search in javascript using the following regex.</p>
  
  <pre><code>str = "Test String C.S (example)";
  var regex_search = new RegExp("\\b"+search_string+"\\b","g");
  if(str.match(regex_search)) != null)
    match = true;
  else
    match = false;
  </code></pre>
  
  <p>The above works well if I search for a normal string like 'String'. But if I search for just 'S', it returns C.S as a match. Also, searching for example returns a match but in this case I do not want a match because it has parenthesis. I just want to match the whole word only. Any suggestions would be greatly appreciated.</p>
  
  <p>--Edit--</p>
  
  <p>Thanks to @plalx Clarified the example.</p>