const text1 = 'I am using regex';
/(?=.*regex)/g.test(text1) // true
const text2 = 'regex is awesome';
/(?=.*regex)/g.test(text2) // true
const text3 = 'regex is util';
/(?=.*util)(?=.*regex)/g.test(text3) // true
const text4 = 'util is necessary';
/(?=.*util)(?=.*regex)/g.test(text4) // false because need regex in text
const regExAll = /.*/s; //notice the 's'
let str = `
Everything
in this
string
will
be
matched. Including whitespace (even Linebreaks).
`;
console.log(`Match:`, regExAll.test(str)); //true
console.log(`Index Location:`, str.search(regExAll));
let newStr = str.replace(regExAll,"🐔");
console.log(`Replaced with:`,newStr); //Index: 0