I'd like to propose a fix to Transactions Regex pattern
Hi! I regularly use this package to parse mt940 files. However, problems appeared when I faced a negative transaction amount. It returns this error:
`booking = _parse_date( transaction.group('date')[:2] transaction.group('booking'))
AttributeError: 'NoneType' object has no attribute 'group'`
So I propose a change to your TRANSACTION_RE variable to handle negative transaction amounts. The variable would be like this:
TRANSACTION_RE = re.compile(r"""
(?P<date>\d{6})
(?P<booking>\d{4})?
(?P<sign>D|C|RC|RD)
(?P<code>\w)?? # ING skips this mandatory field
(?P<amount>-?(\d|,){1,15})
(?P<id>\w{4})
(?P<reference>.{0,34})""", re.VERBOSE)
I have tested it in my local and it works fine. Please update the TRANSACTION_RE variable to handle negative transaction amounts because I depend on your package and my pipeline is breaking because of that. Thank you!
Edited by Cédric Krier