I have a input text field to enter maximum of 5 email address seprated by comma, but there I should validate each email address and also validate if there less than 4 comma on that text. How do we write in single regex expression. I have done this :
[RegularExpression("^(\[\\w+-.%\]+@\[\\w.-\]+\\.\[A-Za-z\]{2,4})(,\[\\w+-.%\]+@\[\\w.-\]+\\.\[A-Za-z\]{2,4})\*$",
ErrorMessage = "Please enter a valid email seprated by comma")\]
public string BCCEmailList { get; set; }
This will validate email address but allows user to enter any number of email seprated by comma.
answer to solve this problem