I'm doing some basic text matching from an input. I need the ability to perform a basic "AND". For "ANY" I split the input by spaces and join each word by the pipe ("|") character but I haven't found a way to tell the regular expression to match any of the words.
switch (searchOption) {
case "any":
inputArray = input.split(" ");
if (inputArray.length > 1) { input = inputArray.join("|"); }
text = input;
break;
case "all":
inputArray = input.split(" ");
***[WHAT TO DO HERE?]***
text = input;
break;
case "exact":
inputArray = new Array(input);
text = input;
break;
}
Seems like it should be easy.