欢迎访问 水平网, 今天是:2010年09月09日 [订阅本站] [用户注册/登录] [收藏本站]
首     页 技术文章 注 册 码 代码仓库 资源下载 技术讨论 实用工具 站内搜索 联系我们
■ 当前位置:首页 >> 代码仓库 >> ASP相关 >> 代码内容

从URL中获取关键词

■ 以下是代码:复制代码】【保存代码
Public Function GetSearchKeyword(RefererUrl)
'on error resume next
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
Dim a, b, j
'模糊查找关键词,此方法速度较快,范围也较大
re.Pattern = "(word=([^&]*)|q=([^&]*)|p=([^&]*)|query=([^&]*)|name=([^&]*)|_searchkey=([^&]*)|wd=([^&]*)|baidu.*?w=([^&]*))"
Set a = re.Execute(RefererUrl)
If a.Count>0 Then
Set b = a(a.Count -1).SubMatches
For j = 1 To b.Count
If Len(b(j))>0 Then GetSearchKeyword = URLDecode(b(j))
Exit Function
Next
End If
If Err Then
Err.Clear
GetSearchKeyword = URLDecode(RefererUrl)
Else
GetSearchKeyword = ""
End If
End Function
TAGS:URL关键词
■ 发表评论
您的称呼:
联系方式:
验 证 码 : 看不清楚?点击刷新验证码 看不清楚?点击图片刷新验证码
■ 最新评论显示所有评论