-1

enter image description hereenter image description here 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

enter image description here

Community
  • 1
  • 1
Baktha
  • 27
  • 2

1 Answers1

0

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

Faizan
  • 1
  • 1