I have a string
var str = "{CPARTY_<BPARTY+_DPARTY}";
I need to find all occurences of below string (find) in main string(str).
var find = "{CPARTY_<BPARTY+_DPARTY}";
and replace it with below string.
var replace = "<span><div ng-click='myClick($event)' title='null' data-token='CPARTY_<BPARTY+_DPARTY' style='display: inline;'>{CPARTY_<BPARTY+_DPARTY}</div></span>";
This doesn't work. That means no replacement done. No exception thrown.
str = str.replace(new RegExp(find, 'g'), replace);
This works.
str = str.replace(find, replace);
I want to use the replace all syntax.I have realized that it has something to do with special characters < and $lt; If I don't have < and $lt; , there is no issue. I know it's something very silly but can't figure it out.
jsFiddle https://jsfiddle.net/848c1as4/9/