vickey
vickey

Reputation: 55

validating dxtextbox using regex

I am trying to validate a text box where user will only be allowed to enter alphabets,number,and few special characters like !, @, #, $, %, &, * currently I tried only [a-zA-Z0-9] which accepts only alphabets And number,can someone please suggest me a regex which will help me to get the same.

Upvotes: 1

Views: 1009

Answers (2)

Nicholas
Nicholas

Reputation: 1714

/^[a-zA-Z0-9!@#$%&*]+$/g should work for you. This will validate if the the complete string is composed of one or more characters found within the square brackets.

To familiarize yourself with some regular expressions syntax and meaning, I would suggest using RegExr. This provides an online validator, explains each element of the expression and has helpful tips/examples in the side bar to help with expression building.

Upvotes: 2

Piyush.kapoor
Piyush.kapoor

Reputation: 6803

/[a-zA-Z0-9!@#$%]$/g.test('aaaaa!jbhjj@@@')

Upvotes: 0

Related Questions