Other Resources:
MasterCard credit card number validation
All credit card numbers issued by MasterCard must start with 51 through 55 and have 16 digits. For example, 5271190242643112 is a valid MasterCard credit card number.
How to write a single regular expression to validate a MasterCard credit card number described above?
✍: FYIcenter.com
Here is the regular expression for MasterCard credit card number validation:
^5[1-5][0-9]{14}$
^ - begin of the string
5 - matches 5 itself
[1-5] - 1, 2, 3, 4, or 5
[0-9] - any decimal digit
{14} - repeating 14 times
$ - end of the string
2013-01-22, 0👍, 0💬
Popular Posts:
All credit card numbers issued by American Express must start with 34 or 37 and have 15 digits. For ...
How to write a regular expression to validate GUID (Globally Unique IDentifier) or UUID (Universally...
How to write a regular expression to parse key-value entries from Windows .INI files? Here is an exa...
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
How to write a regular expression to validate GUID (Globally Unique IDentifier) or UUID (Universally...