Ramco Ramco

Ramco Ramco

  • 475
  • 2.6k
  • 376.7k

Regular Expression

Jun 15 2021 4:17 PM

Hi

 In below Reqgular expressiob i want - Required & MaxLength condition should be separate.

In Special Character i want to allow only Alphabet , Space & BackSpace

[DataType(DataType.Text)]
        [RegularExpression(@"^[a-zA-Z'.\s]{1,25}$", ErrorMessage = "Special Characters not allowed")]
        [Required(ErrorMessage = "Please enter Location"), MaxLength(25)]
        [Display(Name = "Description")]

 

Thanks


Answers (2)