How do I dynamically Assign a pattern?
I've tried:
var str = "hebbbbllo";
var patt = new RegExp;
patt =("b", "g");
console.log(str.match(patt).length);
But the code produces an error:
Uncaught TypeError: Cannot read property 'length' of null
I've also tried to use the pattern "/b/g" but it also doesn't work