I have a string and I want to find all 13 digits numbers in it. I wrote the code like this, but the problem is that I get a list which contains just the first 13 digits number. Any one knows where's the problem.
my text:
9311105005816 POTTING MIX OSMOCOTE PRO 501 PREMIUM 107899 4711414284189 BBQ ACC CLEANING SMALL GRILL BRUSH^ 9312566048022 SPRAY PAINT FIDDLY BITS 250G GREY PRIMER 9312324001115 GARDEN BASICS 25L ALL PURPOSE POTTING MIX 2 @ $3.50 8711167004368 FIRE IGNITION FIRELIGHTR SAMBA 36PK WHITE BRICK SAKF36 6 @
my code:
import re
with open("Receipt.txt") as f:
lines = f.readlines()
index_subtotal = lines[0].find("SubTotal")
index_tax_invoice = lines[0].find("TAX INVOICE 'Kip' ")
len_tax_invoice = len("TAX INVOICE 'Kip' ")
print(lines[0][index_tax_invoice + len_tax_invoice:index_subtotal])
print("*" * 30)
my_pattern = lines[0][index_tax_invoice + len_tax_invoice:index_subtotal]
my_pattern_list = re.findall("^(?:.*?(\d{10,13}).*|.*)$", my_pattern)
print(my_pattern_list)