Regular Expression Validator syntax

M

Mark B

I have 3 Text Boxes on a aspx 3.5 page:

Credit Card Type:
Name On Card:
Card #:

If someone can suggest the appropriate validation expressions for a Regular
Expression Validator I'd appreciate it -- I'm new to that syntax...
 
J

Jesse Houwing

Hello Mark,
I have 3 Text Boxes on a aspx 3.5 page:

Credit Card Type:
Name On Card:
Card #:
If someone can suggest the appropriate validation expressions for a
Regular Expression Validator I'd appreciate it -- I'm new to that
syntax...


My guess it that you will use a dropdown for cardtypes supported by your
application. There's a lot of them if you start digging... Once did a project
involving 50 countries and more than 8 payment gateways, each supporting
different credit/debit card schemes.

Same goes for the cardnumber, Amex has a different format than MasterCard
and Visa.. So unless you have an exhaustive list of cardtypes that you will
want to support, I can only suggest ^[0-9]+$ as format, e.g. only allowing
numbers.

For the name on the card, usually, letters, numbers and a small number of
punctuation characters suffices.
^[a-zA-Z0-9.,]$ should handle most cases you'll encounter... But if you
are also allowing german customers, or peple from Russia or Japan, things
will get wonkey ;).

If you're using a payment gateway, look at what restrictions they place on
cardnumbers and names, and copy those.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top