Only character or Number

Arch4ngel

Senior Contributor
Joined
Mar 22, 2004
Messages
940
Location
Montreal, QC
Ok... I'm not used to RegularExpression...
I got a serial number that is only composed of character and number (their position aren't regular). I want to use a RegularExpression to make sur that their is only character and number in the text box.

I use a RegularExpressionControlValidator. ControlToValidate is set to a TextBox named txtNoSerial.

Some help could help me!

(I know I could have done it in a loop and verify character by character but I want it done by a regular expression as far as it can do it.)
 
\w should do the trick - matches any "Word" character, including underscore - [a-zA-Z0-9_]

the "opposite" is \W which matches any "non-Word" character outside of the above list
 
Back
Top