I use MVC data annotations, and my requirement is that the address field can contain any characters except (for example, English characters) < > . ! @ # % / ? *.
I searched many sites but did not get how to write this regex.
So far I have tried:
[Required(ErrorMessage = "Address Required.")]
[RegularExpression(@"^[<>.!@#%/]+$", ErrorMessage = "Address invalid.")]
public string Address { get; set; }
source
share