escapeRegex method

String escapeRegex(
  1. String str
)

Escape regex special characters

Implementation

String escapeRegex(String str) {
  return str.replaceAll(RegExp(r'[.*+?^${}()|[\]\\]'), r'\$&');
}