parse method

List<Link> parse()
override

Implementation

parse() {
  String pattern =
      r"(http(s)?:\/\/)?(www.)?[a-zA-Z0-9]{2,256}\.[a-zA-Z0-9]{2,256}(\.[a-zA-Z0-9]{2,256})?([-a-zA-Z0-9@:%_\+~#?&//=.]*)([-a-zA-Z0-9@:%_\+~#?&//=]+)";

  RegExp regExp = RegExp(pattern, caseSensitive: false);

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