match static method

String? match(
  1. Pattern pattern,
  2. String subject
)

Returns the first regex match of pattern in subject, or null.

Note: this is a regex match — distinct from the global match() value mapper defined in helper.dart.

Implementation

static String? match(Pattern pattern, String subject) {
  final RegExp regex = pattern is RegExp
      ? pattern
      : RegExp(pattern.toString());
  return regex.firstMatch(subject)?.group(0);
}