match method

  1. @override
List<List<RegExMatch>> match(
  1. String password
)
override

Should return the matches for the password.

A synchronous matcher should return a list (usually of length 1) of lists of matches. An asynchronous matcher can return a list of futures that completes with a list of matches.

Implementation

@override
List<List<RegExMatch>> match(String password) {
  final List<RegExMatch> matches = <RegExMatch>[];
  regExes.forEach((String name, RegExp regEx) {
    for (final RegExpMatch match in regEx.allMatches(password)) {
      matches.add(
        RegExMatch(
          password: password,
          start: match.start,
          end: match.end,
          regExName: name,
          options: options,
        ),
      );
    }
  });
  return <List<RegExMatch>>[matches];
}