用vbscript判断email地址的合法性
2001-02-13 10:16:23 来源:WEB开发网核心提示:这里是一断正则表达式的例子<%Function isemail(strng)isemail = falseDim regEx, Match ' Create variables.Set regEx = New RegExp ' Create a regular exPRession object
这里是一断正则表达式的例子
<%
Function isemail(strng)
isemail = false
Dim regEx, Match ' Create variables.
Set regEx = New RegExp ' Create a regular exPRession object (stupid, huh?)
regEx.Pattern = "^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$" ' Sets pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
Set Match = regEx.Execute(strng) ' Execute search.
if match.count then isemail= true
End Function
%>
<%
Function isemail(strng)
isemail = false
Dim regEx, Match ' Create variables.
Set regEx = New RegExp ' Create a regular exPRession object (stupid, huh?)
regEx.Pattern = "^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$" ' Sets pattern.
regEx.IgnoreCase = True ' Set case insensitivity.
Set Match = regEx.Execute(strng) ' Execute search.
if match.count then isemail= true
End Function
%>
[]
更多精彩
赞助商链接