parse method

  1. @override
List<Link> parse()
override

Implementation

@override
parse() {
  String pattern = r"[\w-\.]+@([\w-]+\.)+[\w-]{2,4}";

  RegExp regExp = RegExp(pattern);

  Iterable<RegExpMatch> allMatches = regExp.allMatches(text);
  List<Link> links = <Link>[];
  for (RegExpMatch match in allMatches) {
    links.add(Link(regExpMatch: match, type: email));
  }
  return links;
}