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/
Difference is in escaping at least in your case. When you use / / notation, you have to escape '/' with '\/', when you're using Regexp notation you escape quotes