hello all
I am working on a keyword filter and am stuck on something that I am hoping someone has more experience with
my problem is that I am trying to pass a regular expression as a variable to the RegExp() function in javascript but it does not seem to be working
example below
Code:
var X = '^(?=.*?(';
var Y = 'dog))(?=.*?(cat))(?=.*?(mouse'; // this gets created dynamically
var Z = ')).*$';
var A = X + Y + Z;
// result is ^(?=.*?(dog))(?=.*?(cat))(?=.*?(mouse)).*$ and is a valid and tested expression
var B = new RegExp(A, 'i');
I want to pass B to a search() function but it does not seem to be accepted as a valid expression anymore
thanks for any help