Use the following function
Public Function IsEmailValid(strEmail As String) As Boolean
Dim oRegularExpression As Object
' Sets the regular expression object
Set oRegularExpression = CreateObject("VBScript.RegExp")
With oRegularExpression
.Pattern = "^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"
' Ignores case
.IgnoreCase = True
'Test expression string
IsEmailValid = .test(strEmail)
End With
End Function
Public Function IsEmailValid(strEmail As String) As Boolean
Dim oRegularExpression As Object
' Sets the regular expression object
Set oRegularExpression = CreateObject("VBScript.RegExp")
With oRegularExpression
.Pattern = "^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"
' Ignores case
.IgnoreCase = True
'Test expression string
IsEmailValid = .test(strEmail)
End With
End Function
No comments:
Post a Comment