Email regular expression for a specific domain name

This is my code:

<asp:RegularExpressionValidator ID="regexEmail" runat="server" ValidationExpression="(\ w+@ [test]+?\.[com]{3})" ErrorMessage="Please Enter Valid Email Id" ControlToValidate="txtEmailAddress" /> 

which does not work. But my problem does not end. I would also like to know how to check only characters in the username, not numbers and special characters.

Please if anyone can help with this code. Thanks at Advance.

+4
source share
4 answers
 ^[a-zA-Z] +@yourdomain \.com$ 

gotta do the trick

+7
source

At first I think that in square brackets there is an understanding of misses. With [com]{3} you create a character class and match 3 characters from this class, this means that it will match com (I think as you please), but also ccc , cmc , etc.

Similarly for [test]+? , this corresponds to at least 1 character from t , e and s

When you speak:

check only characters in username, not numbers and special characters

I think you mean only letters? Or just the letters ASCII?

What do you mean probably

 (\ w+@test \.com) 

\w is a character class that contains A-Za-z0-9 and _ (and maybe everything that is a letter in Unicode, I'm not sure). If you need only ASCII characters, create your own character class with [A-Za-z] if you want any letter to use the Unicode property \p{L}

Something like that

 @"^(\p{L} +@test \.com)$" 
+2
source

[test] is probably not what you want. This is equivalent to [tes] and means 't' or 'e' or 's'.

You tried something like:

 ^[a-zA-Z] +@. *\.com$ 

This will confirm the email addresses of the form xxx@xxx.com

As a C # literal, this is "^[a-zA-Z] +@. *\\.com$" .

+1
source

MSDN has an article on email authentication.

http://msdn.microsoft.com/en-us/library/01escwtf.aspx

amuses

0
source

All Articles