当前位置: 代码迷 >> ASP >> 怎么提取字段里的地址?
  详细解决方案

怎么提取字段里的地址?

热度:69   发布时间:2013-01-25 15:55:29.0
如何提取字段里的地址??
字段nr下有下面的字符:
<img alt="" src="/editor/attached/image/20130118/20130118180526942694.jpg" /><embed src="/editor/attached/flash/20130118/20130118180531003100.swf" type="application/x-shockwave-flash" width="550" height="400" quality="high" /><a href="/editor/attached/file/20130118/20130118180624112411.zip"  target="_blank">/editor/attached/file/20130118/20130118180624112411.zip</a>
怎么提取里面的所有地址,并循环显示:
/editor/attached/image/20130118/20130118180526942694.jpg
/editor/attached/flash/20130118/20130118180531003100.swf
/editor/attached/file/20130118/20130118180624112411.zip

------解决方案--------------------

str="<img alt="""" src=""/editor/attached/image/20130118/20130118180526942694.jpg"" /><embed src=""/editor/attached/flash/20130118/20130118180531003100.swf"" type=""application/x-shockwave-flash"" width=""550"" height=""400"" quality=""high"" /><a href=""/editor/attached/file/20130118/20130118180624112411.zip""  target=""_blank"">/editor/attached/file/20130118/20130118180624112411.zip</a>"
set reg=new RegExp
reg.Pattern = "\b(?:src
------解决方案--------------------
href)\s*=\s*("")([^""]+)\1"   
reg.IgnoreCase = True    
reg.Global = True   
Set Matches = reg.Execute(str)
For Each Match in Matches   
  response.write Match.SubMatches(1) 
Next
  相关解决方案