Other Resources:
Discover credit card number validation
All credit card numbers issued by Diners Club must start with 6011 or 65 and have 16 digits. For example, 6011186767363105 is a valid Visa credit card number.
How to write a single regular expression to validate a Discover credit card number described above?
✍: FYIcenter.com
![]()
Here is the regular expression to validate a Discover credit card number:
^6(?:011|5[0-9]{2})[0-9]{12}$
^ - begin of the string
6 - matches 6
(?:011|5[0-9]{2}) - non-capturing group of 2 possible parts
011 - matches 011
| - or operator
5[0-9]{2} - 3 digits start with 5
[0-9] - any decimal digit
{12} - repeating 12 times
$ - end of the string
2021-02-13, 0👍, 3💬
Popular Posts:
Are you having problems using regular expressions when processing text strings in your applications ...
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
How to capture the Baidu spider entries from Web log file? Here are some Web log file entries: 127.0...
Are you having problems using regular expressions when processing text strings in your applications ...
How to capture the Soso Spider entries from Web log file? Here are some Web log file entries: 127.0....