在提取asp提取数据库内容的时候的时候,如何去掉字段中的【html与图片地址】只提取文字
问题描述:
dailyMsg = RS("calendarText")
if FormatStr(dailyMsg)<>"" then
Response.Write (" <span style='font-size:14px;font-weight:bold;'>" & aCalendarDays((iWeek-1)*7 + iDay) & "<BR></span><A HREF=""" & strPage & """ style='line-height:16px;'>" & Left(nohtml(FormatStr(dailyMsg)),80) & "
答
正则去掉html代码
Function removeHtml(s)
Dim re
Set re = New RegExp
re.Pattern = "<[^>]+>"
re.IgnoreCase = True
re.Global = True
removeHtml=re.Replace(s,"")
End Function
s="<a href='http://www.w3dev.cn/'><b>w3dev</b></a> <font color=red>w3dev.cn</a>"