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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.