Let me sketch out what I'm doing here.
The system has contracts, each of which may have account numbers associated with it. From the type of the contract I know what the types of the accounts should be. I'm working on the screens where they can add/edit account numbers.
Because of the number of different account numbers that I need to validate and the rate of change, I didn't want to just include a huge pile of specific account validation rules. This was done in the past and ran more then a page of code and the old system didn't handle as different types of accounts as it has to now.
So what I did is create a table that associates each type of account with a regular expression that validates that type of account. Then when I build the page I can just insert the regular expression into a validation test in the OnChange event of each account as I go.
For most of the accounts this works perfectly. It's particularly handy for the account numbers that are trivial variations. I've got a lot of rules that say the account number must be 10 digits and start XXX, where XXX is some specific number or small set of numbers.
I also included a hook to add special validation code for specific account types that couldn't be cleanly handled in the regular expression since I knew some of the rules could not be handled in a regular expression.
But I was surprised that there doesn't seem to be a clean way to specify this rule in a regular expression. It seems almost inane to me that regular expressions implement 'or' but not 'and'.
Jay