How can I:
"the weather is nice today"
var myRe = new RegExp("weather","gi");
var myReToString = myRe.toString(); // myReToString is now "/weather/gi"
var myReCopy = /* How to get this copy only from myReToString ? */
You can use
eval to get back the regular expression:
var myRe = RegExp("weather", "gi"); var myReString = myRe.toString(); eval(myReString); // => /weather/gi
eval only if you're sure the string is generated from regular expression