I am using MVC data annotations and my requirement is that the address field can contain any characters (i.e. other than English characters are also allowed) except < > . ! @ # % / ? *.
I searched many sites but not getting how to write this regex.
So far I have tried:
[Required(ErrorMessage = "Address Required.")]
[RegularExpression(@"^[<>.!@#%/]+$", ErrorMessage = "Address invalid.")]
public string Address { get; set; }
Currently, you are only allowing string consisting ONLY of these letters.
Use