JSFiddle - React, Tailwind, and code Playground
by himel023
JavaScript
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
str1 = "a1erAe23eAo.";
str2 = "([}asd";
refined = escapeRegExp(str2);
console.log(refined)
re = new RegExp(refined, "gi");
console.log(re);
//re3 = new RegExp(str3, "gi");
//re4 = new RegExp(str4, "gi");
//re5 = new RegExp(str5, "gi");
re6 = new RegExp(str6, "gi")
//onsole.log(str1.match(re2));
//console.log(str1.matchu(re3);
console.log(str1.match(re3));