escapeRegex static method

String escapeRegex(
  1. dynamic string
)

Implementation

static String escapeRegex(string) {
  return ('' + string).replaceAllMapped(
      RegExp(r'([?!${}*:()|=^[\]\/\\.+])'), (match) => '\\${match.group(0)}');
}