title: How to exclude anchor tags?
body: <p>The code below will take an input and run it through a reviews list looking for the keyword and will wrap the keyword with a Mark tag which highlights it. </p>
  
  <p>This almost works except that the REGEX also replaces the keyword if it is found in between anchor tags.</p>
  
  <p>How can I change the regex below to ignore anchor tags?</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thank you. </p>
  
  <pre><code>inputHighlight: function(){
      let currentURL = document.location.toString(),
          reviewList = $('.review-list');
  
      if(currentURL.indexOf('kw') !== -1){
          var reviews = reviewList.html();
          var term = utilities.queryString.getQueryValue("kw");
          term = term.replace(/(\s+)/,"(&lt;[^&gt;]+&gt;)*$1(&lt;[^&gt;]+&gt;)*");
  
          var pattern = new RegExp("("+term+")", "gi");
  
          reviews = reviews.replace(pattern, "&lt;mark&gt;$1&lt;/mark&gt;");
          reviews = reviews.replace(/(&lt;mark&gt;[^&lt;&gt;]*)((&lt;[^&gt;]+&gt;)+)([^&lt;&gt;]*&lt;\/mark&gt;)/,"$1&lt;/mark&gt;$2&lt;mark&gt;$4");
  
          reviewList.html(reviews);
      }
  }
  </code></pre>