public static void regexTest(){
String text = "what/B is/I going/E on/E ,/N (/N han/B mei/I mei/E )/N ./N";
Pattern pattern = Pattern.compile("\\s{2,}|\\t{1,}");
Matcher matcher = pattern.matcher(text);
String strBlank = matcher.replaceAll(" ");
String[] str = strBlank.split(" ");
for(int i = 0; i < str.length; i++)
{
System.out.println(str[i]);
}
正则表达式分割小片段
最新推荐文章于 2024-05-06 17:36:06 发布