Danny Scofield Danny Scofield - 1 year ago 96
Vb.net Question

How to validate E-Mail Address Format

I found following code from this link.


Function IsValidEmail(strIn As String) As Boolean
' Return true if strIn is in valid e-mail format.
Return Regex.IsMatch(strIn, "^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")
End Function

I dont know how to use above code.
I mean how to call above code?

Answer Source

you can use it as below

If IsValidEmail("inputemail@domain.com") Then
        'valid email
       'invalid email
End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download