I have a series of reference codes that my end users create during the course of the day.  These reference codes correspond to a transaction code that is stored in a database.  As of now, there are 15 difference transaction codes.Here's an example:Tranasction Code - Reference CodeBB01             - 48912388C949             - X717-9999and so on...New transaction codes can be added at any time.  Whether the transaction code is new or not, all corresponding reference codes must be in a certain format.  I plan on using regular expressions to validate the reference codes using Javascript.Now here's the question.Am I better off doing something like thisvar transactionCode = $('input[name=TransactionCode]').val();var referenceCode = $('input[name=ReferenceCode]').val();// Do this type of test for all 15 types of reference codes until I// succeedif (transactionCode === 'BB01') {    var results = /\d{8}/.test(referenceCode);    // if results is true, blah blah blah}Create a SQL table of reference codes and matching regexs.  Query the database and construct a javascript object (similar to a dictionary/hash of key value pairs) when needed where I pass the reference code as a key to retrieve the regex to validate against my transaction code.The second approach seems like overkill for a small data set.   But the advantage is I don't have to hard-code my transaction codes when testing and when more codes are added or removed, I don't have to manually mess with them in JavaScript.  Where as if I take the first approach, I have to hard code my transaction codes.  Not only that, but if the transaction code ever changes, then I have to change the javascript.I wanted to get someone's feedback on this approach or another alternative if I'm missing something.
Validating transaction codes with reference codes... Best way to encode the validation rules?
c#;javascript