-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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})
var regex = new Regex(@"^(?<valuedate>(?<year>\d{2})(?<month>\d{2})(?<day>\d{2}))(?<entrydate>(?<entrymonth>\d{2})(?<entryday>\d{2}))?(?<creditdebit>C|D|RC|RD)(?<fundscode>[A-z]{0,1}?)(?<ammount>\d*[,.]\d{0,2})(?<transactiontype>[\w\s]{4})(?<reference>[\s\w]{0,16})(?:(?<servicingreference>//[\s\w]{0,16}))*(?<supplementary>\r\n[\s\w]{0,34})*"); |
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.
Metadata
Metadata
Assignees
Labels
No labels