parse static method

LinkedInProfileUrl? parse(
  1. String url
)

Implementation

static LinkedInProfileUrl? parse(String url) {
  var matches = RegExp(
          r'(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/in\/(?<permalink>[\w\-\_À-ÿ%]+)\/?')
      .allMatches(url);
  var permalink = matches.getValue("permalink");
  if (permalink == null) {
    matches = RegExp(
            r'(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/pub\/(?<permalink_pub>[A-z0-9_-]+)(?:\/[A-z0-9]+){3}\/?')
        .allMatches(url);
    permalink = matches.getValue("permalink_pub");
  }
  if (permalink == null) return null;
  return LinkedInProfileUrl._(permalink);
}