Jump to content

Recommended Posts

Posted

Function EmailAddressCheck(ByVal emailAddress As String) As Boolean

    ' Pattern ou mascara de verificação

    Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"

    ' Verifica se o email corresponde a pattern/mascara

    Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)

    ' Caso corresponda

    If emailAddressMatch.Success Then

        Return True

    Else

        Return False

    End If

End Function

tou com um problema, na linha "Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)"

o vb nao me reconhece regex.match

Posted

tou com um problema, na linha "Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)"

o vb nao me reconhece regex.match

Tens de fazer um import

Imports System.Text.RegularExpressions

Posted

Desculpa, tive a ver bem o codigo e tive a ver onde eu o uso e ai tens de colocar onde escreves o texto que queres validar por exemplo:

Textbox.text

Entendes?

sim. 😞

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.