首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

取字段中的指定内容,该怎么解决

2012-02-05 
取字段中的指定内容取字段中的指定内容字段中有内容如下:imgheight 75 src /tools/loadimg.asp?File

取字段中的指定内容
取字段中的指定内容
字段中有内容如下:
<img   height= "75 "   src= "/tools/loadimg.asp?FileName=200779154654641.gif "   width= "250 "   border= "0 "   />
<img   height= "75 "   src= "/tools/loadimg.asp?FileName=200779154654642.gif "   width= "250 "   border= "0 "   />
<img   height= "75 "   src= "/tools/loadimg.asp?FileName=200779154654643.gif "   width= "250 "   border= "0 "   />

我想取出其中三个图片文件的文件名,
200779154654641.gif
200779154654642.gif
200779154654643.gif
怎么取。用ASP的编写。谢谢了。

[解决办法]
<%
dim str
str = " <img height= " "75 " " src= " "/tools/loadimg.asp?FileName=200779154654641.gif " " width= " "250 " " border= " "0 " " /> "
str = str& " <img height= " "75 " " src= " "/tools/loadimg.asp?FileName=200779154654642.gif " " width= " "250 " " border= " "0 " " /> "
str = str& " <img height= " "75 " " src= " "/tools/loadimg.asp?FileName=200779154654643.gif " " width= " "250 " " border= " "0 " " /> "
Dim regEx, Match, Matches ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = "FileName=(\d+)\.gif " ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
regEx.Global = True ' 设置全局替换。
Set Matches = regEx.Execute(str) ' 执行搜索。
For Each Match in Matches ' 遍历 Matches 集合。
Response.Write(Replace(Match.Value, "FileName= ", " ")& " <br/> ")
Next
%>

热点排行