I\'m looking for an easy way to turn this string:
(java || javascript) && vbscript
Into this string:
(str.search(\'java
You can call replace:
replace
mystring.replace(/[-\w]+/g, "str.search('$&')");
Note that this is an XSS hole, since the user input can contain 's.
'