function replaceAll(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
var data = ':['
data = replaceAll(data, ':\[', "/\\");
Error returned: Invalid regular expression: /:[/: Unterminated character class
I have seen other posts relating to this to escape the '[', but I have done that and it doesn't work.
Obviously I'm doing something wrong here and I'm not that familiar with RegEx things, so anybody help please?