A result from searching within a string.
A Match or an Iterable of Match objects is returned from the Pattern matching methods (Pattern.allMatches and Pattern.matchAsPrefix).
The following example finds all matches of a RegExp in a String and iterates through the returned iterable of Match objects.
final regExp = RegExp(r'(\w+)');
const string = 'Parse my string';
final matches = regExp.allMatches(string);
for (final m in matches) {
String match = m[0]!;
print(match);
} The output of the example is:
Parse my string
Some patterns, regular expressions in particular, may record substrings that were part of the matching. These are called groups in the Match object. Some patterns may never have any groups, and their matches always have zero groupCount.
group.
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/Match-class.html