I have to check if a string contains some special character, and if it does, add a backslash to it.
var spChar=['%','^','!'];
If string is "This contains % and ^ characters".
I want to make it "This contains \% and \^ characters".
I dont want to loop through all the characters. Is there anyway i can achieve this by using regex