熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 獲取字符串中url地址函數

2022-06-13   來源: .NET編程 

  asp教程 獲取字符串中url地址函數
本文章提供了三款利用asp的正則獲取字符串中url地址自定義函數哦三個方法的實現原理都是獲取以http開的url地址哦
on error goto z

  dim urlkeywwwname
url=requestservervariables("server_name")
if instr(url"")> then
key=split(url"")
wwwname=key()
wwwname=replace(wwwname"http://""")
end if
responsewrite(wwwname)

  方法二

  vbnet
public shared function isurl(byval strtmp as string) as boolean
on error goto z
dim objintpattern as new systemtextregularexpressionsregex( "^(http://|https教程://){}[azaz][azaz]+[azaz][azaz]{}[]*$")
return objintpatternismatch(strtmp)
z:
end function

  private sub button_click(byval sender as systemobject byval e as systemeventargs) handles buttonclick
msgbox (isurl( "
方法三

  dim objintpattern
isurl = false
set objintpattern = new regexp
objintpatternpattern = "^(http://|https://){}[azaz][azaz]+[azaz][azaz]{}[]*$"
objintpatternglobal = true
isurl = objintpatterntest(strtmp)
set objintpattern = nothing
z:
end function

  private sub command_click()
msgbox isurl( "
end sub


From:http://tw.wingwit.com/Article/program/net/201311/14016.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.