JSFiddle - React, Tailwind, and code Playground
JavaScript
var testAgainst = ['and','+',',','&'];
var toTest = ['This is just a test +','This is just a test and','This is just a test ,','This is just a test &','This is just a test'];
for(var i = 0; i < testAgainst.length; i++){
for(var j = 0; j < toTest.length; j++){
if (toTest[j].indexOf(testAgainst[i]) > -1){
console.log('match: ' + testAgainst[i]);
}else{
console.log('no match');
}
}
}