I have the following which works fine, allowing a form field to be valid if blank or containing the word "hello" or passing the other validation...
var re = new RegExp(/^$|^[hello]|^([FG]?\d{5}|\d{5}[AB])$/);
but I want to make the word "hello" be the value of a variable.
I have tried this but it no longer seems to work:
var i = "hello";
var re = new RegExp('/^$|^['+i+']|^([FG]?\d{5}|\d{5}[AB])$/');