getIdFromUrl static method

String getIdFromUrl(
  1. String url, [
  2. bool trimWhitespaces = true
])

Implementation

static String getIdFromUrl(String url, [bool trimWhitespaces = true]) {
  if (url == null || url.length == 0) return "";

  if (trimWhitespaces) url = url.trim();

  url = url.replaceAll("%3A", ":");
  url = new HtmlUnescape().convert(url);
  url = url.replaceAll("<!", "");
  url = url.replaceAll("\"", "");
  url = url.replaceAll("\n", "");

  for (var exp in _regexps) {
    Match? match = exp.firstMatch(url);
    if (match != null && match.groupCount >= 1) return match.group(1)!;
  }

  return "";
}