SharpMt940Lib.Core icon indicating copy to clipboard operation
SharpMt940Lib.Core copied to clipboard

Parser fails when transaction string contains amount without decimal separator

Open Petur06 opened this issue 5 years ago • 0 comments

Given statement with the following line :61:2012031203CR20NMSCVS0015060871 the parser throws System.Data.InvalidExpressionException: '2012031203CR20NMSCVS0015060871'

I narrowed it down to the fact that the amount in this case does not contain the decimal separator.

As seen in the regex, the decimal separator is expected. (?<ammount>\d*[,.]\d{0,2}) https://github.com/mjebrahimi/SharpMt940Lib.Core/blob/937177b21612b80b5cee7e87d6c00bcb72e24add/Raptorious.SharpMt940Lib/Transaction.cs#L130

In the PR, you can see two changes to the regex:

  1. removed '?' from the 'fundscode' group
  2. added {0,1} to the 'ammount' group

Simply adding {0,1} to the 'ammount' group did not help, I also had to remove the '?' from the 'fundscode' group.

#11

Petur06 avatar Dec 04 '20 10:12 Petur06