Email Regular Expression MVC C#

MVC Email Regular Expression C#

Validate email address in C# .NET with Regular Expressions
using System.ComponentModel.DataAnnotations set email address validation expression

[RegularExpression(@"^([0-9a-zA-Z]([\+\-_\.][0-9a-zA-Z]+)*)+@(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z0-9]{2,3})$", ErrorMessage = "Your email address is not in a valid format. Example of correct format: [email protected]")]

[RegularExpression(@"^([0-9a-zA-Z]([\+\-_\.][0-9a-zA-Z]+)*)+@(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z0-9]{2,3})$", ErrorMessage = "Your email address is not in a valid format. Example of correct format: [email protected]")]   
[DataType(DataType.EmailAddress)]
public string EmailAddress{ get; set; }
Email Regular Expression MVC C# Email Regular Expression MVC C# Reviewed by Bhaumik Patel on 8:31 PM Rating: 5