Is it possible to have a dynamically generated string
var string= "a,b,c";
and make a regex out of that that accepts any of the strings words as accepted matches?
regExApproved = new RegExp(string, 'ig');
So that we can search a data-attribute of an element and show it if it has any of the accepted matches in the attribute
$(this).attr("data-payment").match(regExApproved)
The problem im facing is the regex takes the whole string and makes that the only match case.
I need the regex to break the string down and accept ANY word in it as a match
Is this possible? I do not want to use a forloop and make LOTS of different regex Matches for each word in the string but maybe I have to?