public partial class NormalRegistration
{
public int Id { get; set; }
[RegularExpression(@"^[a-zA-Z''-'\s]*$", ErrorMessage = "Please Enter valid Name")]
[Required]
[StringLength(50)]
public string Name { get; set; }
[Required(ErrorMessage = "Email_id must not be empty")]
[RegularExpression(".+\\@.+\\..+", ErrorMessage = "Please Enter valid mail id")]
public string Email { get; set; }
}
}
I am writing validations in models in mvc4 ,i am using regular expressions also.some times are working and sometimes are not working.can you please tell me how to getrid of this problem?

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 6, 2014, 1:03 AM EST
What is your input? What should be your expected output?
Sasi ReddyRank #4,458 · 342 reputationPosted Feb 6, 2014, 1:53 AM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 7, 2014, 12:32 AM EST