函数功能:
自动给网址加上A标签,例如在文本中有http://www.cw951.com,自动转换为
<a href="http://www.abc.com">http://www.cw951.com</a>
函数如下:
Function PzRegExpUrl(sChar)
Dim regEx,match,matches
Set regEx = New RegExp
regEx.Pattern = "http://[a-z0-9^~`_./^-^?=&]+" '设置正则匹配模式
regEx.Global = True '设置全程性质
regEx.IgnoreCase = True '是否区分大小写
Set matches = regEx.Execute(sChar)
For Each match In matches
sChar = Replace(sChar,match.value,"<a href="""&match.value&""">"&
match.value&"< /a>")
Next
PzRegExpUrl = sChar
End Function
函数调用:
Dim sContent sContent = "<div><ul><li>http://cw951.com/index.asp</li></ul></div>" sContent = PzRegExpUrl(sContent) response.write sContent