forum

Home / DeveloperSection / Forums / Email address validation in C# MVC 4 application: with or without using Regex

Email address validation in C# MVC 4 application: with or without using Regex

Anonymous User 2379 01-Dec-2014

I have an MVC 4 web application and I need to enter and validate some email addresses, without sending an email to the user's email address. 

Currently I am using basic regex email validation with this pattern: 

[RegularExpression(@"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z",

        ErrorMessage = "Please enter correct email address")]

Although this is validating email addresses, it passes 1@1.1 as a valid email address. For the moment I have a validation that requires symbols @ symbols . symbols where the symbols can be numeric/alphabetic and ._- . 

I need more standard email validation for my MVC 4 application. How do I do that?


Updated on 02-Dec-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By