Ramco Ramco

Ramco Ramco

  • 439
  • 3.4k
  • 545.1k

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)