扩大一下替换范围
把width=\"120\" 替换为 width=\"100\"
直接数字替换容易将其他参数也替换了
把width=\"120\" 替换为 width=\"100\"
直接数字替换容易将其他参数也替换了
解决方案 »
- 在Spring的配置文件里面配置AOP 例外通知时出现异常
- hibernate映射列名问题 (描述详细)
- struts2下载问题(下载路径动态配置在xml中)
- 刚学spring+hibernate 想问下 spring的声明式事务 跟 OpenSessionInViewFilter 功能是不是重复了。。。
- 使用dwr,为什么后台java代码执行了,但是前台的js回调函数不执行呢?
- form中的值不能填入相应的actionform中(急急..............)
- struts或J2EE中关于编码规范的讨论
- 求教:封装N列的交叉表(单表)的算法?
- Jbuilder9.0企业版调用webservice的问题,求助!!
- EntityBean部署又出错了....大哥们帮帮忙...看那出错了.....
- java 兔子问题
- 请问struts2 的Action中从ServletContext获取的request和servlet中的request有什么不同?
'width=\\\"[0-9]+\\\"'
$("img").each(function(){$(this).css("width","100%")})
String a = "<img src=\"aa.png\" width=\"120\" />";
Pattern pattern = Pattern.compile("width=\"[0-9]*\"");
Matcher matcher = pattern.matcher(a);
while(matcher.find()) {
a = a.replace(a.substring(matcher.start(),matcher.end()), "width=\"100%\"");
break;
}
String a = "<img src=\"aa.png\" width=\"120\" />";
System.out.println(a.replaceAll("(.*width=\")\\d+(.*)","$1100$2"));