Hello Trytonies,
thanks to tremendous help by @lars_wuerfel , I could achieve alignment of bank statements (legacy MT940 import) with parties by this regex string:
.*(?i:Solawi.Beitrag).*\?32(?P<party>.*)
Now I tried to align newer CAMT52 statements with this string:
.*(Solawi.Beitrag).(?P<party>.*)
But that one does not work. Which expression do I need to find
[any_noise]Solawi Beitrag prename surname
where ‘prename surname’ matches the party name in question?
Thanks a lot in advance,
EG
ced
(Cédric Krier)
February 23, 2026, 8:52am
2
The regexp you provide match with the string also provided.
But I suspect that there may be more than 1 space between the 2 groups also you do not seem to have the need to create a group for “Solawi Beitrag”. This should be fixed with:
.*Solawi.Beitrag.+?(?P<party>.*)
Thank you, Sir, for your quick reply.
Unluckily, I could not make it work with your suggestion either.
EG
ced
(Cédric Krier)
February 25, 2026, 4:06pm
4
Well it works with the example you provided so I suspect that you did not provided the right example.
htgoebel
(Hartmut Goebel)
March 12, 2026, 4:55pm
5
I would go for:
lignore case (?i:_)
matching white space \s
matching multiple white spaces \s+, taking as many an possilbe
Thus my pattern would be: .*(?i:Solawi\s+Beitrag)\s+(?P<party>.*).
Anyway. ced’s pattern would match, too.
BTW: There are many online tools available for testing Python regexs, e.g. https://pythex.org/ (random choice of what the internet search showed me)