findAll method

List<String> findAll(
  1. Pattern pattern
)

Returns a list of all substrings that match the pattern.

Example:

'hello world'.findAll(RegExp(r'\w+')); // ['hello', 'world']

Implementation

List<String> findAll(Pattern pattern) {
  final matches = pattern.allMatches(this);
  return matches.map((match) => match.group(0) ?? '').toList();
}