如题,我想在ASP脚本(VBScript)中使用正则表达式检测EMail的格式的合法性,该如何实现?
---------------------------------------------------------------
用"来代替/即可
---------------------------------------------------------------
Function IsEmailInput(patrn,strng)
Set regEx=New RegExp '建立变量
regEx.Pattern=patrn '设置模式
regEx.IgnoreCase=true '不区分大小写
retVal=regEx.Test(strng) '执行搜索测试
if retVal then
IsEmailInput="Email格式合法"
Else
IsEmailInput="Email格式非法"
End if
End Function
response.write IsEmailInput("^([\.\w-]){3,}@([\w-]){3,}(\.([\w]){2,4}){1,2}$","[email protected]")