Regular Expressions 101

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(\;?(3[0-9]{14}|[4-5][0-9]{15})=2[0-9](01|02|03|04|05|06|07|08|09|10|11|12)[1-2][0-6]{2}[a-zA-Z0-9 ]{7,13}\??)
/
gm

Description

Captures Track2 data, with or without start and ending sentinels ( ; and ? )

Only captures AMEX 15 digits, and Visa or MC with 16 digits. Does NOT support 13 digit credit cards and they are not in use anymore.

Submitted by BigDAD - 3 years ago