코드 사본은 다음과 같습니다.
public static string gethost (문자열 URL) {
if (url == null || url.trim (). equals ( "")) {
반품 "";
}
문자열 호스트 = "";
패턴 p = pattern.compile ( "(? <= // |) ((// w)+//.)+// w+");
매치 업체 매치 자 = p.matcher (URL);
if (matcher.find ()) {
host = matcher.group ();
}
리턴 호스트;
}