May-02-2023, 08:23 PM
(May-02-2023, 08:17 PM)bowlofred Wrote: Your findall only matches when there is a "weight" followed by one character from [;:]. That character isn't optional. If it's missing, no match.
So you want it to be an optional match. Add a?
after the character class.
r'(?<=weight[:;]?).*?(?=kg)
Thanks for your reply, it still does the same thing :(
['16.696,00'] ['16.981,44', '13.672,10', '16.981,44', '16.981,44', '16.235,86'] ['17.046,00'] ['18.345,00'] ['17.624,00'] ['17,063.00'] [] ['18.583,000'] ['18.520,00'] ['16.981,44']