Всем привет. Подскажите почему не работает. При переводе в строку итерация не выполняется((
#FIXME: Not all bins are listed (not sure about Maestro)
PAN_re = re.compile(r'''\b(?:(?P<visa>4\d{15})|'''
r'''(?P<mastercard>5[1-5]\d{14})|'''
r'''(?P<discover>6(?:011|5\d{2})\d{12})|'''
r'''(?P<amex>3[47]\d{13})|'''
r'''(?P<diners>3(?:0[0-5]|[68]\d)\d{11})|'''
r'''(?P<jcb>(?:2131|1800|35\d{3})\d{11}))\b''')
##TODO: Add full card track search:
IATA_re = re.compile(r'''(?P<SS>%)(?P<FC>A|B|[C-M]|[N-Z])'''
r'''(?P<PAN>\d{13,19})\^(?P<NM>[\w \/\.]{2,26})\^'''
r'''(?P<ED>\d\d([0-2]\d|3[0-1]))(?P<SC>\d{3})'''
r'''(?P<PVV>\d{5})(?P<DD>\w+)(?P<ES>\?)(?P<LRC>\w)''')
report = {}
count = 0
@classmethod
def match(cls, data):
""" Find matches in chunk of data """
for m in cls.PAN_re.finditer(data):
print("TEST")
group = m.lastgroup
pan = m.group(group)
if is_valid(pan):
cls.report.setdefault(cls.fp.name, [])
cls.report[cls.fp.name].append(Card(pan, group, cls.masq))
TypeError: cannot use a string pattern on a bytes-like object