Extract payee from memo field

Timon Fiddike timon-kmymoney at fiddike.com
Mon Jan 15 22:58:57 UTC 2018


Hi Thomas,

yeah! This works perfectly :-D

Thank you!!

Details between your lines (shortened quote):

>> How does the "Extract payee from memo field" feature work?
>> 
>> You can find in here:
>> "Edit Account" > "Online Settings" > "Extract payee from memo field using
>> regular expressions”
[…]
>> documentation of
>> the QRegExp class http://doc.qt.io/archives/qt-4.8/qregexp.html#1 <http://doc.qt.io/archives/qt-4.8/qregexp.html#1> without
>> success.
[…]
>> How are the two fields meant to be used?
> 
> These fields are only evaluated, when the payee field is empty, which is the 
> case when you need the feature. The payee field should contain the regex that 
> extracts the payee from the memo (Verwendungszweck), the second one should 
> extract the memo part.
> 
> In your case it seems to be something like
> 
>   ^Kartenzahlung Debitkarte([^/]+)/.*
> 
> for the payee and
> 
>   ^Kartenzahlung Debitkarte[^/]+/(.*)
> 
> for the memo.

Thank you!! This works perfectly for the account I asked about.

And now I understand the concept so I think I’ll be able to adapt it as needed for other accounts :-)

After exploring import, reporting etc. this was the last thing I needed before using KMyMoney in production. And KMyMoney was the last thing I needed to switch from macOS to GNU/Linux, because on macOS I used ifinance as the only "Mac-only" tool and otherwise LibreOffice and a lot of OSS that I can continue to use on GNU/Linux. Yeah, made my day!

> The strings you enter in the fields are used as QString str in
> 
>  QRegExp regex(str, Qt::CaseInsensitive)
> 
> and evaluated in
> 
>  if(regex.indexIn(memo_from_bank) != -1) {
>    result = regex.cap(1);
>  }
> 
> The QRegExp::cap(1) member is used to extract the info for payee and memo.
[…]
> I hope that helps. The example code is taken from the Qt5 based version but is 
> otherwise identical in the Qt4 version.

Thank you for pointing that out!

So now I know that the QRegExp documentation is indeed the place to check if I need to :-)

Thank you & good night!

Timon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20180115/ca2d6653/attachment-0001.html>


More information about the KMyMoney mailing list