Regex : SyntaxError: nothing to repeat
<p>I am trying to highlight search results as searched from input.</p>

<p>Highlight is working well but it does not handle special characters like (**) etc. I am getting error</p>

<blockquote>
  <p>SyntaxError: nothing to repeat</p>
</blockquote>

<p>jQuery Used to highlight is:</p>

<pre><code>$(function() {

  $("#search").on("input", function() {

    var ths = $(this);
    hightlight(ths.val());
  });

});

function hightlight(txt) {

    $(".search-results tr td div").each(function (i, v) {
        var regex = new RegExp( '(' + txt + ')', 'gi' );
        v.innerHTML = v.innerText.replace(regex, "&lt;strong&gt;$1&lt;/strong&gt;");
    });

}
</code></pre>

<p>I have made a demo on Plunker </p>

<p><a href="https://plnkr.co/edit/9Ed7SkTYyJNkZfiG4ypa?p=preview" rel="nofollow noreferrer">Link Here</a></p>