Is there any difference between using new RegExp(\"regex\"); and /same_regex/ to test against a target string? I am asking this question because I
new RegExp(\"regex\");
/same_regex/
this will be a help for you http://www.regular-expressions.info/javascript.html see the 'How to Use The JavaScript RegExp Object' section
if you are using RegExp(regx) regx should be in string format ex:- \w+ can be created as regx = /\w+/ or as regx = new RegExp("\\w+").
regx = /\w+/
regx = new RegExp("\\w+")