I need some simple javascript code for a Vue application that will take a string split it into an array and check if any value is in a different string.
I have
let AffiliationString = " This person goes to Stony Brook"
let affiliation = "Stony Brook OR Stony Brook University OR The University of Washington"
let affiliations = affiliation.toLowerCase().split(" or ");
affiliation = affiliations.join(",");
let regexList = [ affiliation ];
let isMatch = regexList.some(rx => rx.test(AffiliationString));
I want to see if any item in the array is in the "AffiliationString" string
When I do this I get the following error
Uncaught (in promise) TypeError: rx.test is not a function
I have seen many samples on StackOverflow of checking the array if a value is there but not the other way around. I'm trying to use javascript - match regular expression against the array of items
I'm doing this in a Vue project with
"eslint": "6.7.2",
do I need to redo it as a loop for each value in the array?
Thanks for your help