I am trying to understand why writing regex as a string is not working but using it without string does work.
this is my example:
var patt = new RegExp("/test_.*/gi");
var res = patt.test("test_4");
console.log(res);
will return false
but this:
var patt = /test_.*/gi;
var res = patt.test("test_4");
console.log(res);
will return true
what is the difference
gflag withtest