import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String arg[]){
String str="http://33.google.cn/search?q=%E4%B8%96%E5%8D%9A%E8%AE%A2%E6%88%BF%E7%BD%91&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:zh-CN:official&client=firefox-a";
Pattern pattern= Pattern.compile("\\w+(\\.\\w+){1,}");
Matcher matcher=pattern.matcher(str);
while(matcher.find()) {
String group = matcher.group();
System.out.println(group);
}
}
}
java 获取域名
最新推荐文章于 2024-08-16 10:08:14 发布