I need to implement a regular expression validation that allows a-z A-z 0-9 and some special characters _ - . @ &
But should restrict
\ / " : ; * ? " < > { } [ ] ( ) | ! ' % ^
tried this pattern but doesn't work.
[Required]
[Display(Name = "User name")]
[RegularExpression("^[-a-zA-Z0-9_-@]*", ErrorMessage = "Invalid characters!")]
public string UserName { get; set; }
Could you please suggest?
-two times?