替换字符
本帖最后由 water197 于 2010-8-24 12:16 编辑<?xml version="1.0" encoding="utf-8"?><data>
<item url="movie.asp?id=5" target="_blank" img="Xml/hot/1.jpg" thumb="Xml/hot/1i.jpg" />
<item url="movie.asp?id=11259" target="_blank" img="Xml/hot/2.jpg" thumb="Xml/hot/2i.jpg" />
<item url="/" target="_blank" img="Xml/hot/3.jpg" thumb="Xml/hot/3i.jpg" />
<item url="movie.asp?id=587" target="_blank" img="Xml/hot/4.jpg" thumb="Xml/hot/4i.jpg" />
<item url="movie.asp?id=9270" target="_blank" img="Xml/hot/5.jpg" thumb="Xml/hot/5i.jpg" />
</data>
搜索指定行列id=后5位数字,然后写入替换
例如2行id=后面5位数字,然后写入替换
怎么写,谢谢 $str ='<?xml version="1.0" encoding="utf-8"?><data>'&@CRLF& _
'<item url="movie.asp?id=5" target="_blank" img="Xml/hot/1.jpg" thumb="Xml/hot/1i.jpg" />'&@CRLF& _
'<item url="movie.asp?id=11259" target="_blank" img="Xml/hot/2.jpg" thumb="Xml/hot/2i.jpg" />'&@CRLF& _
'<item url="/" target="_blank" img="Xml/hot/3.jpg" thumb="Xml/hot/3i.jpg" />'&@CRLF& _
'<item url="movie.asp?id=587" target="_blank" img="Xml/hot/4.jpg" thumb="Xml/hot/4i.jpg" />'&@CRLF& _
'<item url="movie.asp?id=9270" target="_blank" img="Xml/hot/5.jpg" thumb="Xml/hot/5i.jpg" />'&@CRLF& _
'</data>'
$sn = StringRegExpReplace($str,"(?<=id\=){5}","替换")
MsgBox(0,"",$sn)这样? 列的指定呢?
<?xml version="1.0" encoding="utf-8"?><data>
<item url="movie.asp?id=5" target="_blank" img="Xml/hot/1.jpg" thumb="Xml/hot/1i.jpg" />
针对这一列 假設樓上變量str值寫入文件str.xml中
$File = Fileopen("str.xml",0)
$rLine = Filereadline($File,2)
$rn = StringRegExpReplace($rLine,"(?<=id\=){*}","替换")
MsgBox(0,"",$rn)
页:
[1]