I\'m trying to escape the quotes (and apostrofes and escape char) in a text string in javascript:
var text = \'Escape \" and \\\' and /.\'; var rx = new RegExp(\
Escaping means using backslash \ but not slash /.
\
/
However, for your purposes you can try the following:
text.replace(/([/'"])/g, "/$1");
DEMO: http://jsfiddle.net/hvtgf/1/