日期:2014-05-17  浏览次数:21416 次

提取文章中的图片标签!!!
如何提取数据库备注型字段中的 <img   ...   </img> 标签,最终得到在网页能够显示!!!

------解决方案--------------------
replace(str , " <img> " , " <img src= ")
replace(str , " </img> " , "> ")
------解决方案--------------------
Function ReplaceText(fString,patrn,replStr)
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
regEx.Global = True ' 设置全局可用性。
ReplaceText = regEx.Replace( " "&fString& " ", " "&replStr& " ") ' 作替换。
Set reg=nothing
End Function

str=ReplaceText(str, "\[IMG\]([^ "&CHR(34)& "[]*)(\[\/IMG\]) ", " <img border=0 src=$1> ")