Originally posted by honghunter at 2007-12-8 18:03:
首先谢谢三楼的回复。
不过代码执行后,好像没有移除那些行。
调试中……
也许可能不能处理特殊字符的缘故
假设htm文件内容:
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<td style="ad250_60">
<script type="text/JavaScript">
var alimama_pid="mm_10039567_157615_200541";
var alimama_titlecolor="0000FF";
var alimama_descolor ="000000";
var alimama_bgcolor="FFFFFF";
var alimama_bordercolor="E6E6E6";
var alimama_linkcolor="008000";
var alimama_sizecode="13";
var alimama_width=250;
var alimama_height=60;
var alimama_type=2;
</script>
<script src="http://p.alimama.com/inf.js" type=text/javascript>
</script></td>
</head>
<body>
</body>
</html>
b.txt内容:
不同行<td style="ad250_60">
不同行<script type="text/JavaScript">
var alimama_pid="mm_10039567_157615_200541";
var alimama_titlecolor="0000FF";
var alimama_descolor ="000000";
var alimama_bgcolor="FFFFFF";
var alimama_bordercolor="E6E6E6";
var alimama_linkcolor="008000";
var alimama_sizecode="13";
var alimama_width=250;
var alimama_height=60;
var alimama_type=2;
不同行</script>
不同行<script src="http://p.alimama.com/inf.js" type=text/javascript>
不同行</script></td>
处理后这样是不是想要的?
<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<td style="ad250_60">
<script type="text/JavaScript">
</script>
<script src="http://p.alimama.com/inf.js" type=text/javascript>
</script></td>
</head>
<body>
</body>
</html>
Last edited by terse on 2007-12-8 at 07:15 PM ]