I’m trying to replace all occurrences of a string ***deal*** When I use the following code I receive a Quantifier {x,y} following nothing error.
var regex = new RegExp('***deal***', 'g');
Content=Content.replace(regex, DEAL);
Can anyone fill me in how I’m supposed to get past the error?
As a note I’m using Server Side Javascript with a .NET backend.
Thanks
*is a metacharacter (meaning “zero or more of the preceding token”, and there is nothing preceding the*s in your regex, hence the error message) that needs to be escaped:I’ve used a regex literal because that allows you to cut down on the number of backslashes; the equivalent using a regex constructor would be