By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,969 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,969 IT Pros & Developers. It's quick & easy.

Validate textbox with mask

P: 1
I need to validate a packslip using a mask. In the past I have validated that all characters are numbers and that the first one is not zero. Now they want to be able to set a mask, such as 9XX99999XX where the X is either a letter or integer, 9 would be integer only.

This mask would be different for different suppliers.

Thank you in advance!
Jennifer
Apr 16 '09 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
the best bet would probably be something around a Regular Expression.

using 9XX99999XX it should be something like
Expand|Select|Wrap|Line Numbers
  1. RE = /\d[a-z0-9]{2}\d{5}[a-z0-9]{2}/i;
  2. // sometimes [:alnum:] can be used for [a-z0-9]
an (more or less technical) explanation to the RegExp object can be found here.
Apr 16 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.