asp从编辑中过滤和显示图片分别怎么写
asp从编辑中过滤和显示图片分别怎么写,请高人请教下。(通过后编辑器加的文章,中间带有图,想单独显示文字或图)
[解决办法]
这个是用正则把图片摘出来,其余的就是内容了
content=rs("content")'数据库的内容字段 Set re = New RegExp re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)" re.Global = True re.IgnoreCase = True Set Contents = re.Execute(content) For Each Match in Contents ' 遍历匹配集合。 Response.Write "<img src='"&Images & Match.SubMatches(1)&"' />" Next
[解决办法]
content=rs("content")'数据库的内容字段 Set re = New RegExp re.Pattern = "<img(.+?)src=""*([^\s]+?)""*(\s|>)" re.Global = True re.IgnoreCase = True Set Contents = re.Execute(content) For Each Match in Contents ' 遍历匹配集合。 Response.Write "<img src='"&Images & Match.SubMatches(1)&"' />" Next content=re.replace(content, "") '把图片过滤掉,剩下的就是文字了,上面那个匹配的就都是图片了,自己可以运行测试就输出结果看下就明白了