62,615
社区成员
发帖
与我相关
我的任务
分享
String[] sa = { //测试字符串
"..test.major information.http://www.abcdefg.com.2012",
"...http://www.abcdefg.com/index.html.2011",
".Mike, G..this is for test.2012",
".Bob, E. J..make a mark.2010,15(2):60-71"
};
for (String s : sa) {
//把URL以外的[.]转成[|],再把名字缩写的[|]转成[.],再按[|]分割
String[] ss = s.replaceAll("(?<!www)[.](?!(html|com))", "|").replaceAll("(?<=[A-Z])[|]", ".").split("[|]");
System.out.println(Arrays.toString(ss));
}