Just curious. what are the differences between?
var a=text.replace(/(Nullam|ligula|in)/ig,'`<b>$1</b>`');
with
var string = "Nullam|lingula|in";
var pattern = new RegExp (string, "ig");
var a=text.replace(pattern ,'`<b>$1</b>`');
This should gives out the same result, but it doesn't. Any thoughts?
Thank you
$0instead of$1in your second example, then you'd get the same result in both. Actually, you'd also get that if you used$0in the first example.