static protected HashSet<String> scanContentForHosts(CharSequence content){
  HashSet<String> set=new HashSet<String>();
  Matcher mat=uriPattern.matcher(content);
  while (mat.find()) {
    String found=mat.group();
    Matcher cleanMat=uriCleanup.matcher(found);
    if (cleanMat.find()) {
      found=cleanMat.group(1);
    }
    cleanMat=uriCleanup2.matcher(found);
    if (cleanMat.find()) {
      found=cleanMat.replaceAll("");
    }
    cleanMat=uriCleanup3.matcher(found);
    if (cleanMat.find()) {
      found="mailto://" + cleanMat.group(1) + cleanMat.group(2);
    }
    cleanMat=schemePattern.matcher(found);
    if (!cleanMat.find()) {
      if (found.matches("^(?i)www\\d*\\..*")) {
        found="http://" + found;
      }
 else       if (found.matches("^(?i)ftp\\..*")) {
        found="ftp://" + found;
      }
    }
    String host=hostFromUriStr(found);
    if (null != host) {
      host=host.toLowerCase();
      if (!set.contains(host)) {
        set.add(host);
      }
    }
  }
  mat=emailAddrPattern.matcher(content);
  while (mat.find()) {
    String found=mat.group();
    debugOut("******** mailfound=\"" + found + "\"");
    found="mailto://" + found;
    debugOut("*******6 mailfoundfound=\"" + found + "\" after cleanup 6");
    String host=hostFromUriStr(found);
    if (null != host) {
      host=host.toLowerCase();
      if (!set.contains(host)) {
        set.add(host);
      }
    }
  }
  return set;
}

static protected HashSet < String > scanContentForHosts ( CharSequence content ) { HashSet < String > set = new HashSet < String > ( ) ; Matcher mat = uriPattern . matcher ( content ) ; while ( mat . find ( ) ) { String found = mat . group ( ) ; Matcher cleanMat = uriCleanup . matcher ( found ) ; if ( cleanMat . find ( ) ) { found = cleanMat . group ( 1 ) ; } cleanMat = uriCleanup2 . matcher ( found ) ; if ( cleanMat . find ( ) ) { found = cleanMat . replaceAll ( "" ) ; } cleanMat = uriCleanup3 . matcher ( found ) ; if ( cleanMat . find ( ) ) { found = "mailto://" + cleanMat . group ( 1 ) + cleanMat . group ( 2 ) ; } cleanMat = schemePattern . matcher ( found ) ; if ( ! cleanMat . find ( ) ) { if ( found . matches ( "^(?i)www\\d*\\..*" ) ) { found = "http://" + found ; } else if ( found . matches ( "^(?i)ftp\\..*" ) ) { found = "ftp://" + found ; } } String host = hostFromUriStr ( found ) ; if ( null != host ) { host = host . toLowerCase ( ) ; if ( ! set . contains ( host ) ) { set . add ( host ) ; } } } mat = emailAddrPattern . matcher ( content ) ; while ( mat . find ( ) ) { String found = mat . group ( ) ; debugOut ( "******** mailfound=\"" + found + "\"" ) ; found = "mailto://" + found ; debugOut ( "*******6 mailfoundfound=\"" + found + "\" after cleanup 6" ) ; String host = hostFromUriStr ( found ) ; if ( null != host ) { host = host . toLowerCase ( ) ; if ( ! set . contains ( host ) ) { set . add ( host ) ; } } } return set ; }
scans a character sequence for uris . then returns all unique host strings derived from those found uris in a hashset
