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:
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
How to capture the MSN (Microsoft Network) bot entries from Web log file? Here are some Web log file...
How to capture the Baidu spider entries from Web log file? Here are some Web log file entries: 127.0...
How to write a regular expression to validate GUID (Globally Unique IDentifier) or UUID (Universally...
How to capture the MSN (Microsoft Network) bot entries from Web log file? Here are some Web log file...