Escapes any potential regex syntax characters in a string, and returns a new string that can be safely used as a literal pattern for the RegExp() constructor.
method
RegExpConstructor.escape
const re = new RegExp(RegExp.escape("foo.bar"));
re.test("foo.bar"); // true
re.test("foo!bar"); // false