Validation for specific emailid in C#.net

Posted by Rrana under ASP.NET on 9/22/2011 | Points: 10 | Views : 4861 | Status : [Member] | Replies : 5
hi,

i have a task,that, i want to validate the specific emailid in my application

for Example:- if user enter his emailid like suchi@gmail.com, it won't accept. it only accept my company's mailid like(suchi@antheliohealth.com)

thanks in advance

Sucharitha Goud
Bank Of America..



Responses

Posted by: Blessyjees on: 9/22/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi Friend

Using this regExp ^([a-zA-Z0-9_\-\.]+@antheliohealth.com)$ to validate the emailid.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 9/22/2011 [Member] Starter | Points: 25

Up
0
Down
Take a look at this article to learn regular expression so that you can apply it to some other problem in future.
http://www.dotnetfunda.com/articles/article1260-b-ball-c-cat-d-dog-learning-regex-regular-expression-the-easy-wa-.aspx

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mittaikariss on: 9/28/2011 [Member] Bronze | Points: 25

Up
0
Down
hay bro its very simple i just refer above link and then igot it....
Regex re = new Regex(@"^[a-zA-Z0-9]{1,10}@(antheliohealth).(com|org)$");

if (!re.IsMatch(textBox4.Text))
{
MessageBox.Show("Please enter Correct Email Id");
}


^[a-zA-Z0-9]{1,10}@(antheliohealth).(com|or g)$ 


and also thanks MR.Ndebata....

http://www.invomtech.com/

....sundarsowmia....

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mdjack on: 9/28/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try this,

string strRegex = @"^([a-zA-Z0-9\.]+)@(antheliohealth).(|com|in|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|tv|)$";

N. MOHAMED ZACKKARIAH

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mdjack on: 9/28/2011 [Member] Starter | Points: 25

Up
0
Down
string strRegex = @"^([a-zA-Z0-9\.]+)@(antheliohealth).(|com|in|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|tv|)$";

N. MOHAMED ZACKKARIAH

Rrana, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response