PennController for IBEX › Forums › Support › RegExp Help › Reply To: RegExp Help
September 9, 2020 at 3:14 pm
#6060
Jeremy
Keymaster
Hi Sam,
You cannot use the ||
operator inside a PennController test command like that. The TextInput text test command accepts either a string or a regex as its argument—what you’re doing here is passing the first non-null disjunct, which will necessarily be new RegExp(variable.Option1) because this constructor will never return null (or undefined, etc).
Long story short, you want to build a single regex object that will match both Option1 and Option2, like this: new RegExp(variable.Option1+"|"+variable.Option2)
Jeremy