AspDotNetDev wrote:
JavaScript does also have a sinsible way to create a regex variable:
var reggy = new RegExp("someregex", "options");
As for JavaScript, just keep in mind that the literal form
/regex/
is compiled once (when the script is loaded), whereas the explicit constructor call
new RegExp(pattern, options)
is compiled every time it's passed. see JavaScript RegExp Object... Regex is more enjoyable if you (can!) use(=write) it when needed. I have never regretted to have learned. (syntax isn't a big challenge any more)