读书人

asp去代码解决思路

发布时间: 2012-04-10 21:03:56 作者: rapoo

asp去代码
大家好,请问有这么一组代码:
   <img src= "images/1.gif " height= "25 " width= "25 ">   大家好,能回答我的问题吗?  
我想取出
<img src= "images/1.gif " height= "25 " width= "25 ">
,它前面和后边的是动态的,
请问怎么实现

[解决办法]
<img src= "images/1.gif " height= "25 " width= "25 "> 是固定的话:
r.pattern = " <img src= " "images\/1.gif " " height= " "25 " " width= " "25 " "> "

如果不固定,但字符串中只出现一次IMG,可以这样:
r.pattern = " <img[\s|\S]*?> "
[解决办法]
s = "   <img src= " "images/1.gif " " height= " "25 " " width= " "25 " ">   大家好,能回答我的问题吗?   "
Set regEx = New RegExp
regEx.Pattern = "( <img (.+)> )? "
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(s)
For Each Match in Matches
Response.Write Server.HTMLEncode(Match.SubMatches(0))
Next

读书人网 >ASP

热点推荐