java正则表达式查找替换字符串怎么写?
本帖最后由 gzronald70 于 2013-08-01 17:03:19 编辑 原始字符串
<div><font color=red>##{cityName}##</fond></div>
<div>I love cityName</div>
String s = "<div><font color=red>##{cityName}##</fond></div>";
Pattern pat = Pattern.compile("(?<=<div>).*(?=</div>)");
Matcher mat = pat.matcher(s);
while (mat.find()) {
System.out.println(s.replace(mat.group(), "I love xx"));
}