var regex =/^([\w-]+(?:.[\w-]+))@((?:[\w]+.)\w[\w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$/i;
Errors :
\ "unexpected character"
? "invalid expression term "
w "the name does not exist in the current content"
The above one is showing error as below
If you use regular expression in a model class then to this way. I use regular expression in my model class as a seen below:
[Required]
[StringLength(50)]
[RegularExpression(@"\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b", ErrorMessage = "example@gmail.com like this pattern")]
public string Email { get; set; }
Follow this method if match your requirment