I have a string and two words from a dictionary and I am trying to know if in my string there are words that are not my dictionary words.
var string = 'foobarfooba';
var patt = new RegExp("[^(foo|bar)]");// words from dictionary
var res = patt.test(string);
console.log(res);//return false
It should return true because in my string there is also 'ba', but it return false.
var patt = /foo|bar/;