I am building a simple RegExp helper for my own personal use. Essentially, it's going to work with method chaining and return the string with all of the selected elements.
The question I have is how to use a character class with the RegExp constructor. Here is my code:
var pattern = new RegExp(this.expression.join(''), "g");
As you can see, I am passing my expression in the first argument and a flag in the second.
My question is, how can I use the RegExp constructor and wrap it in a character class, like /[...]/?