extract method

  1. @override
List extract(
  1. dynamic input
)
override

Process input and extract necessary data.

  • Note: the output is usually passed to the next extractor in the chain.

Implementation

@override
List extract(input) {
  final inputSource = RegexExtractor.prepareInputSource(input);

  if (inputSource == null) {
    return [];
  } else {
    return _regExpList
        .map((regExp) => regExp.allMatches(inputSource))
        .where((matches) => matches.isNotEmpty)
        .expand((matches) => matches)
        .map((match) => match.namedGroup(outputGroup))
        .where((element) => element != null)
        .toList();
  }
}