I want to check is some text is in a string for instance i have a string
str = \"car, bycicle, bus\"
and I have another string
if(str.indexOf(str2) >= 0) { ... }
Or if you want to go the regex route:
if(new RegExp(str2).test(str)) { ... }
However you may face issues with escaping (metacharacters) in the latter, so the first route is easier.