Pattern: Credit card number

“Credit card number” is one of the patterns that you can select on the Match panel. Use this pattern to match a series of digits that looks like a credit card number from one or more of the world’s major credit card issuers.

Visa

Turn on to accept Visa credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

MasterCard

Turn on to accept MasterCard credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

American Express

Turn on to accept American Express credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

Diners Club

Turn on to accept Diners Club credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

Discover

Turn on to accept Discover credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

JCB

Turn on to accept JCB credit card numbers.

Brand-specific number validation is only done when the field validation mode is set to "average" or "strict".

No Spaces or Dashes

Do not allow any spaces or dashes in the credit card number.

If you're going to use your regular expression to validate user input on an order from, you should first use a regex like \D+ to strip out all non-digits entered by the user. Then validate the remaining digits with the credit card number regex generated with the option "no spaces or dashes" selected.

Spaces and Dashes to Group Digits

Allow spaces and dashes to group the digits in the credit card number, like it appears embossed on an actual credit card.

This option only works when the field validation mode is set to "average" or "strict". If you set it to "none" or "loose", selecting to allow spaces and dashes for grouping will allow them anywhere.

Spaces and Dashes Anywhere

Allow any amount of spaces and dashes anywhere in the credit card number.

Use this option to scan for credit card numbers in documents, if you don't want to miss any numbers that have been obfuscated with spaces or dashes. It may yield false positives in documents with lists of numbers.

Examples