Custom Regular Expression
Posted on 2006-11-09
First of all, is that an oxymoron?
I need a regular expression that is designed to handle a customer's account #. I know the format of the account number but it can change (dashes, spaces, last digit optional) so I'm not sure how to write this expression. I figure somebody who knows this stuff well could write it without too much trouble or at least point me in the right direction. Thanks!
The # is printed on the bill like this: 00-0000000 0 so 2 digits, dash, 7 digits, space, last digit
In the field where they enter their customer #, they may or may not enter the dash after the first two digits and may or may not enter the space before the last digit. I also want to make the last single digit optional all together. Please let me know if I did not explain that well enough. Thanks in advance.