Regular Expressions 101

Library entries

Credit Card Numbers

Vote

0

Regular Expression
pcre

/
(?# This regex was created for the purposes of detecting potentially compromised credentials for the purposes of information security and not to be used for malicious purposes.) (?<!\d) (?# s - Short [less than 16 digits], m - Medium [16 digits], l - Long [more than 16 digits; not yet implemented]) (?# First four digits) (?: (?# Standard 16 digit numbers) (?<m> (?#MasterCard between 222100-272099) 222[1-9]|223\d|2[3-6]\d{2}|27[01]\d|2720| (?#JCB is between 3528-3589) 352[89]|35[3-8]\d| (?#Visa, MasterCard, Discover) [4-6]\d{3} )| (?#American Express 15 digits | Diners Club 14 digits) (?<s>(?<ax>3[47]\d{2})|(?<dc>30[0-5]\d|36\d{2})) ) (?# Rest of the card number) (?<del>\D+)?(?(<m>)\d{4}(?(<del>)\k{del})\d{4}(?(<del>)\k{del})\d{4}|(?:\d{6})(?(<del>)\k{del})(?(<ax>)\d{5}|\d{4})) (?#END) (?!\d)
/
gmx

Description

Loading markdown...
Submitted by anonymous - a year ago