Jump to content

[SOLVED] Validate a liberty reserve number


sloth456

Recommended Posts

Hi I have a form where users are required to enter their Liberty reserve account number (liberty reserve is a payment processor)

 

An account number always starts with the letter "U" followed by 7 digits.

 

So an example would be

 

U2581606

 

How can I check that a user has inputted a number in this exact format?

If the form has it's own  Liberty reserve account number field, You have a few choices;

 

a) ensure that that field has a limited set of allowable characters, -or-

b) Have no restrictions, and upon processing the variable, strip that variable of all spaces (in the event the user inserts say a space between U and the numbers for example - perhaps for formatting purposes, much like some people do when filling out credit card numbers.. or maybe even strip out all non alphanumerics altogether in the event of say a dash insertion), then based off of Ken's pattern, do something like this: #^U\d{7}$# or #^U[0-9]{7}$# for extra assurance...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.