String str="<HTML><IMG src="/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"><IMG src="/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"><IMG src="/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"></HTML>"我想把src="/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/XX.gif"的所有图片路径换成
src=" http://localhost:8080/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/02.gif"
请 各位高手 指点
src=" http://localhost:8080/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/02.gif"
请 各位高手 指点
解决方案 »
- 哪位有codeLogic类似的java代码查看器
- 写JSP时出现了个问题,请大家帮个忙~
- @@@@@@@@@@@<html:error/>的问题
- 编译后文件怎么生成到web目录下
- 启动workshop,运行hello示例程序时总报错:weblogic.management.ApplicationException: prepare failed for AccountEJB.jar
- 请问这个EXCEPTION是由于什么造成的?
- Struts问题,本来一切正常,但在Struts-config中配置了data-sources后。。。
- 新手请教 如何判断jboss安装是否成功?
- JAVA语言的可读性比较差,关键字和变量可以连在一起,看着真累!!!
- weblogic配置导向时此时不应出现/JAVA/jdk/bin
- 用java程序调用sqlserver存储过程的问题!急!!!
- 搞怪的编码!!jsp页面用gbk编码, 被编译后报错? 搞怪!!!!!!!!!! 搞怪!!!!!!!!!!!!!!
参考如下
String str="csdnandj2seandcsdn";
str.replace("csdn", "nbchina");
System.out.println(str);
public class StringDLL { static String str = "<HTML>"
+ "<IMG src=\"/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif\">"
+ "<IMG src=\"/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif\">"
+ "<IMG src=\"/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif\">"
+ "</HTML>";
static String relStr = "http://localhost:8080"; public static void main(String[] args) {
System.out.println(str
.replaceAll("(<IMG\\s+src=\\s*\")([^\"]+)(\"\\s*>)", "$1"
+ subStr + "$2$3"));
}}
运行结果如下:<HTML><IMG src="http://localhost:8080/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"><IMG src="http://localhost:8080/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"><IMG src="http://localhost:8080/eWebEditor_demo/htmlEditor/eWebEditor/sysimage/emot/09.gif"></HTML>
System.out.println(str.replaceAll("a", "b"));