ASP如何读取数据库中一个字段里所有的图片URL
ACCESS数据库,表名:about,字段名:content,字段值:"<IMGsrc=""/Upload/EditorFiles/201001/201001180943...
ACCESS 数据库,表名:about,字段名:content,字段值:"<IMG src=""/Upload/EditorFiles/201001/20100118094344263.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094350655.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094358351.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094405817.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094319328.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094332418.jpg"" border=0><BR><BR>"
目标:提取该字段所有图片路径。如:/Upload/EditorFiles/201001/20100118094332418.jpg
只有一个字段 展开
目标:提取该字段所有图片路径。如:/Upload/EditorFiles/201001/20100118094332418.jpg
只有一个字段 展开
4个回答
展开全部
我来写一个函数吧。参数就是字段里的所有内容。返回值是以 |隔开的图片地址:
function getimgurl(str)
set objregEx = new RegExp
objregEx.IgnoreCase = true
objregEx.Global = true
objregEx.Pattern = "http://(.{15,300}?)\.(jpg|gif|png|bmp)"
set matches = objregEx.execute(content)
for each match in matches
getimgurl=getimgurl & match.value &"|"
next
end function
function getimgurl(str)
set objregEx = new RegExp
objregEx.IgnoreCase = true
objregEx.Global = true
objregEx.Pattern = "http://(.{15,300}?)\.(jpg|gif|png|bmp)"
set matches = objregEx.execute(content)
for each match in matches
getimgurl=getimgurl & match.value &"|"
next
end function
展开全部
Dim re AS RegExp
re = new RegExp("(\/[^/]+){3}\.jpg")
Dim M AS Matches
For Each m in re.match($ur_file)
print m.value
Next
re = new RegExp("(\/[^/]+){3}\.jpg")
Dim M AS Matches
For Each m in re.match($ur_file)
print m.value
Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Do While 循环或者 For循环
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
dim result,result1
str="<IMG src=""/Upload/EditorFiles/201001/20100118094344263.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094350655.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094358351.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094405817.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094319328.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094332418.jpg"" border=0><BR><BR>"
set re=new regexp
re.ignorecase=true
re.global=true
re.pattern="<img [^>]*src=""([^"">]+)""[^>]+>"
set m=re.execute(str)
for each n in m
response.write n.submatches(0)&"<br>"
next
set m=nothing
set re=nothing
%>
dim result,result1
str="<IMG src=""/Upload/EditorFiles/201001/20100118094344263.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094350655.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094358351.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094405817.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094319328.jpg"" border=0><BR><BR><IMG src=""/Upload/EditorFiles/201001/20100118094332418.jpg"" border=0><BR><BR>"
set re=new regexp
re.ignorecase=true
re.global=true
re.pattern="<img [^>]*src=""([^"">]+)""[^>]+>"
set m=re.execute(str)
for each n in m
response.write n.submatches(0)&"<br>"
next
set m=nothing
set re=nothing
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询