title: How to replace text containing string with a HTML tag?
body: <p>I am trying to work out how to replace any instance of text on page matching a certain phrase with a HTML tag - the contents should remain the same.</p>
  
  <pre><code>bold("Hello")
  </code></pre>
  
  <p>The code above should be replaced with:</p>
  
  <pre><code>&lt;b&gt;Hello&lt;/b&gt;
  </code></pre>
  
  <p>Here is the code that I am currently using:</p>
  
  <pre><code>node.data = node.data.replace('bold("','&lt;b&gt;');
  node.data = node.data.replace('")','&lt;/b&gt;');
  </code></pre>
  
  <p>The problem with this is that rather than creating a <code>&lt;b&gt;</code> tag, it converts the <code>&lt;</code> and <code>&gt;</code> into their HTML entities - <strong>&amp;lt; &amp;gt;</strong>.</p>
  
  <p>Also, it seems unpractical to replace all instances of <code>")</code> with <code>&lt;/b&gt;</code>. </p>
  
  <p>What would be the best way to achieve this.</p>
  
  <p>I would appreciate any help with this, thank you!</p>