SharpMt940Lib.Core
SharpMt940Lib.Core copied to clipboard
Parser fails when transaction string contains amount without decimal separator
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:
- removed '?' from the 'fundscode' group
- 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