大家好,请问有这么一组代码:
<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