应用实例:
Select Case fieldID
Case "txtUsername"
result=Validate(inputValue,"^[\u0391-\uFFE5]+$","姓名必须为中文")
Case "txtEmail"
result=Validate(inputValue,"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$","非法的电子邮件格式")
Case "txtPhone"
result=Validate(inputValue,"^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$","电话号码输入有误")
End Select
response.write result
Function Validate(v,p,e)
Dim objRegExp, strResult
strResult=""
Set objRegExp = New RegExp
With objRegExp
.Global = False
.IgnoreCase = True
.Pattern = p
End With
If objRegExp.Test(v) = False Then
strResult = e
Set objRegExp = Nothing
End If
Validate = strResult
End Function

