28,409
社区成员




dim str,pd
str="<div class=cp><ul><li>产品名称 </li> <li>产品说明 </><li>aaa </><li>bbb </><li>ccc </></ul><ul><li>产品名称 </li> <li>产品说明 </><li>aaa </><li>bbb </><li>ccc </></ul>"
call xml_mynews(str,"<ul>\s*<li>([^</li>]+)</li>.+?(.|\n)*?</ul>")
function xml_mynews(str,pd)
Set objRegExp1 = New Regexp
objRegExp1.IgnoreCase = True
objRegExp1.Global = True
objRegExp1.Pattern =pd
set mm=objRegExp1.Execute(str)
For i= 0 to mm.count -1
sheng_title=objRegExp1.Replace(mm.item(i),"$1")
response.write sheng_title&"<br>"
Next
set objRegExp1=nothing
end function
'输出
'产品名称
'产品名称
response.charset="gb2312"
dim str,pd
str="<div class=cp><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul><ul><li>产品名称 </li> <li> <a href=""http://www.jatxw.cn"">产品图片 </a> </></ul></div>"
'str 的值你可以用FSO读取出来,这里就不写了
call xml_mynews(str,"<ul>\s*<li>([^</li>]+)</li>\s+<li>\s+<a\s+href=""([^""]+)"">(.+?)</a>")
function xml_mynews(str,pd)
Set objRegExp1 = New Regexp
objRegExp1.IgnoreCase = True
objRegExp1.Global = True
objRegExp1.Pattern =pd
set mm=objRegExp1.Execute(str)
For i= 0 to mm.count -1
sheng_title=objRegExp1.Replace(mm.item(i),"$1")
sheng_url=objRegExp1.Replace(mm.item(i),"$2")
sheng_name=objRegExp1.Replace(mm.item(i),"$3")
'取出值,如要是要保存数据,就写CALL传到另一个FUNCTION 过程
call responsemessage(sheng_title,sheng_url,sheng_name)
'response.write sheng_title
Next
set objRegExp1=nothing
end function
function responsemessage(x,y,z)
'这里写存入数库代码
response.write x&"<br>"
response.write y&"<br>"
response.write z&"<br>"
'输出结果
end function