Other Resources:
Visa credit card number validation
All credit card numbers issued by Visa must start with a 4 and have 13 or 16 digits. For example, 346997719493686 is a valid Visa credit card number.
How to write a single regular expression to validate a Visa credit card number described above?
✍: FYIcenter.com
Here is the regular expression for Visa credit card number validation:
^4[0-9]{12}(?:[0-9]{3})?$
^ - begin of the string
4 - matches 4
[0-9] - any decimal digit
{12} - repeating 12 times
(?:[0-9]{3}) - non-capturing group of 3 digits
? - match previous group 1 time or nothing
$ - end of the string
2013-01-22, 0👍, 0💬
Popular Posts:
How to capture the Soso Spider entries from Web log file? Here are some Web log file entries: 127.0....
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
How to write a regular expression to parse key-value entries from Windows .INI files? Here is an exa...