title: Exact replace of string in Javascript
body: <pre><code>hidValue="javaScript:java";
  replaceStr = "java";
  resultStr=hidValue.replace("/\b"+replaceStr+"\b/gi","");
  </code></pre>
  
  <p>resultStr still contains "javaScript:java"</p>
  
  <p>The above code is not replacing the exact string java. But when I change the code and directly pass the value 'java' it's getting replaced correctly i.e </p>
  
  <pre><code>hidValue="javaScript:java";
  resultStr=hidValue.replace(/\bjava\b/gi,"");
  </code></pre>
  
  <p>resultStr contains "javaScript:"</p>
  
  <p>So how should I pass a variable to replace function such that only the exact match is replaced. </p>