Shamil Khan
Shamil Khan

Reputation: 35

Regular expression validator for name which allows charactors, numbers,slash,hyphen,space but not allow only numbers and other speacial characters

^[a-zA-Z0-9'@&#.\s]{2,50}$

Iam trying for a regax allowing both numbers and alphabets with space,hyphen,slash for name without allowing only numbers and also not allowing special characters

Upvotes: 0

Views: 469

Answers (1)

npinti
npinti

Reputation: 52185

Something like so seems to work for me: ^([0-9]*[A-Za-z][A-Za-z0-9'@&#.\s\/-]*)$. You could then use the .Length property to ensure that the length is within the expected value.

An example of the expression is available here.

Upvotes: 1

Related Questions