Regular Expression Validator syntax

  • Thread starter Thread starter Mark B
  • Start date Start date
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...
 
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.
 
Back
Top