Closed krzcho closed 8 years ago
thanks for reporting that. Do you know if these header lines are default SWIFT MT940 headers? they look actually different. (for SWIFT headers I have created issue #9 ) What would you expect CMXL to do? are the headers somehow relevant information?
If not we could just strip everything before the first proper tag. This would also solve #8
What do you think?
I do not know whether they are default and I do not think they are relevant I have solved it as mentioned above: I prefix file with "\r\n-\r\n" and make /\r?\n-\r?\n(?:[^:].*\r?\n)+/m statements separator which consumes those header lines (reg exp should not contain matching groups so they are not returned from data.split) (I am not totally sure whether \r? are needed in the regexp)
from our experience the separator depends on the bank and that's why it is easily configurable with a default that matched most of the statements we have had so far. (including the \r)
so your regex basically ignores anything until the first real tag, right?
we could add this as an option - something like Cmxl.config[:strip_statement_headers] = true
A PR would be appreciated or if you want to add your solution as a note to the readme or wiki, that would be awesome and helps the next person.
thanks
they add some header lines in front of each statements I am not sure I am allowed to attach file here It is not possible to cover it by line parser as there is no :tag: here
1601 25V3241A1XAXXX00001 0000 30BMCIMAMCXXXX00001 940 02 :20:BMCI ...
first idea is to prefix file contents with "\r\n-\r\n" and use such /\r?\n-\r?\n([^:].*\r?\n)+/m statements separator which should consume this header but I still get wrong line format...