展会信息港展会大全

asp 获取字符串中url地址函数
来源:互联网   发布日期:2016-03-01 11:41:06   浏览:2281次  

导读:asp教程 获取字符串中url地址函数本文章提供了三款利用asp的正则获取字符串中url地址自定义函数哦,三个方法的实现原理都是获取以http开的url地址哦。on error goto z...

asp教程 获取字符串中url地址函数

本文章提供了三款利用asp的正则获取字符串中url地址自定义函数哦,三个方法的实现原理都是获取以http开的url地址哦。

on error goto z

dim url,key,wwwname

url=request.servervariables("server_name")

if instr(url,".")>0 then

key=split(url,".")

wwwname=key(0)

wwwname=replace(wwwname,"http://","")

end if

response.write(wwwname)

方法二

'vb.net:

public shared function isurl(byval strtmp as string) as boolean

on error goto z

dim objintpattern as new system.text.regularexpressions.regex( "^(http://|https教程://){0,1}[a-za-z0-9][a-za-z0-9-.]+[a-za-z0-9].[a-za-z]{2,}[43-176]*$")

return objintpattern.ismatch(strtmp)

z:

end function

private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click

msgbox (isurl( "http://www.sohu.com"))

方法三

dim objintpattern

isurl = false

set objintpattern = new regexp

objintpattern.pattern = "^(http://|https://){0,1}[a-za-z0-9][a-za-z0-9-.]+[a-za-z0-9].[a-za-z]{2,}[43-176]*$"

objintpattern.global = true

isurl = objintpattern.test(strtmp)

set objintpattern = nothing

z:

end function

private sub command1_click()

msgbox isurl( "http://www.sohu.com")

end sub

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港