I am using data annotations for validation and I want to use a RegularExpression Data annotation to check the string has only ASCII characters.
public class SomeObject
{
[Required]
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
[MaxLength(4000)]
[RegularExpression(@"[^\u0000-\u007F]+")]
public string Text { get; set; }
}
Can you help me fix the regular expression to allow only ASCII characters