0

Hi Regex gurus,

I was developing a asp.net application. I need to validate my email field. I already searched a lot in the web but didn't found any suitable regex for my situation.I need to fulfill the belows criteria

1)Shouldn't allow a user to enter numeric data only. i.e, it shoul not be like 1111@111.11 or 111@111.com

2)Need to allow all the possible symbols and other language characters.For example üäßy._uu@üdäfß.de

3)Along with the above criteria, it should be a valid email.

Can anyone please help me. Thanks in advance.

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Pgmer
0

Follow these steps:

1. Place a RegularExpressionValidator on your form
2. Set the controlToValidate property to the control you want to validate
3. Click on the elipsis button on the validationExpresion property of the control
4. Select internet email address from the list of standard expressions

0

Hi chibex64,
Thanks for your quick reply. But I already done it. It doesn't satisfy my needs.Can you please give me a more customized regular expression by satisfying my criteria.
Thanks

0

You need to write a regular expression for it.

What your need exactly

try this ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$

0
Private Function ValidateEmail(ByVal EmailAddress As String) As Boolean
        Try
            If EmailAddress.Trim.Length = 0 Then
                MsgBox("Please enter the email Address")
                Return False
            End If
            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]$"

            Dim emailAddressMatch As Match = Regex.Match(EmailAddress, pattern)
            If emailAddressMatch.Success Then
                Return True
            Else
                MsgBox("Please enter the valid email address")
                Return False
            End If


        Catch ex As Exception

        End Try
    End Function
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.