日期:2014-05-20 浏览次数:20756 次
i = 0;
p = Pattern.compile("(fds){2,}");//(fds){2,}
m = p.matcher("dsa da fdsfds aaafdsafds aaf");
sb = new StringBuffer();
while (m.find())
{
m.appendReplacement(sb, "dog");
i++;
}
m.appendTail(sb);
System.out.println(sb.toString());
System.out.println(i);