asp 正則表達式檢測http開頭的函數
更新時間:2007年08月08日 12:05:38 作者:
'####################################
'函數:ishttp[str]
'參數:str,待處理的字符串
'作者:木木
'日期:2007/7/12
'描述:檢測HTTP連接地址或地址欄是否以HTTP開頭
'示例:<%=ishttp(http://www.alixixi.com)%>
'####################################
Function ishttp(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(http|HTTP)[A-Za-z]{0,1}\:\/\/"
ishttp = regEx.Test(str)
End function
驗證郵件地址是否符合標準
<%
'******************************
'函數:isemail(strng)
'參數:strng,待驗證的郵件地址
'作者:阿里西西
'日期:2007/7/13
'描述:驗證郵件地址是否符合標準
'示例:<%=isemail(ali@alixixi.com)%>
'******************************
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern = "^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>
正則表達式檢測中國移動電話手機號碼'*********************************************************
'函數:mobilecheck[str]
'參數:str,待處理的字符串
'作者:木木
'日期:2007/7/12
'描述:檢測移動電話手機號碼
'示例:<%=mobilecheck("13912345678")%>
'*********************************************************
Function mobilecheck(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(13[4-9]|15(8|9))\d{8}$"
mobilecheck= regEx.Test(str)
End Function
'函數:ishttp[str]
'參數:str,待處理的字符串
'作者:木木
'日期:2007/7/12
'描述:檢測HTTP連接地址或地址欄是否以HTTP開頭
'示例:<%=ishttp(http://www.alixixi.com)%>
'####################################
Function ishttp(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(http|HTTP)[A-Za-z]{0,1}\:\/\/"
ishttp = regEx.Test(str)
End function
驗證郵件地址是否符合標準
<%
'******************************
'函數:isemail(strng)
'參數:strng,待驗證的郵件地址
'作者:阿里西西
'日期:2007/7/13
'描述:驗證郵件地址是否符合標準
'示例:<%=isemail(ali@alixixi.com)%>
'******************************
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern = "^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$"
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>
正則表達式檢測中國移動電話手機號碼'*********************************************************
'函數:mobilecheck[str]
'參數:str,待處理的字符串
'作者:木木
'日期:2007/7/12
'描述:檢測移動電話手機號碼
'示例:<%=mobilecheck("13912345678")%>
'*********************************************************
Function mobilecheck(str)
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "^(13[4-9]|15(8|9))\d{8}$"
mobilecheck= regEx.Test(str)
End Function
相關文章
學會Python正則表達式,就看這20個例子(腳本之家修正版)
這篇文章主要介紹了學會Python正則表達式,就看這20個例子,需要的朋友可以參考下2020-03-03