escapeForRegex method
Escapes characters in a string that have a special meaning in regular expressions.
Implementation
String escapeForRegex() =>
// The regex finds any special regex character, and the callback prepends a backslash.
replaceAllMapped(_regexSpecialCharsRegex, (Match m) => '\\${m[0]}');