The four includes the 'N' which is placed outside the group.
Reading the specs more closely, it says nowhere that the type field is numeric, so the better regex would be
tag_61_regex = re.compile( '^(?P<date>\d{6})(?P<sign>[CD])(?P<amount>\d+,\d{2})N(?P<type>.{3})' '(?P<reference>\w{1,16})')
I prepared an MP, could you test that please?
The four includes the 'N' which is placed outside the group.
Reading the specs more closely, it says nowhere that the type field is numeric, so the better regex would be
tag_61_regex = re.compile(
'^(?P< date>\d{ 6})(?P< sign>[CD] )(?P<amount> \d+,\d{ 2})N(?P< type>.{ 3})'
'(?P<reference >\w{1,16} )')
I prepared an MP, could you test that please?