Reply to topic

Account Settings - Tab Online Settings

frosch
Registered Member
Posts
8
Karma
0
Dear KMyMoney enthusiasts,

How do I build a regular expression to extract the payee/receiver information from the subject/details of a transaction (Option in Account Settings - Tab Online Settings)?

Could somebody be so kind and give me an example?

Thanks in advance, Thomas
cristian.onet
KDE Developer
Posts
253
Karma
2
OS
Hi,

First you need to take a look at the data from which you want to extract your quotes. It can be from any website. In the on-line quote configuration page from the settings enter the URL for this website. You can use %1 which will be replaced with the security name. After that you need two regular expression for the price and for the date. For example (\d+.\d+) matches something like 5.89, 90.89. You can read more about regular expressions at http://doc.trolltech.com/4.6/qregexp.ht ... characters or even try your own regular expressions with the qt example application http://doc.trolltech.com/4.6/tools-regexp.html


cristian.onet, proud to be a member of KDE forums since 2008-Oct.
User avatar ipwizard
KDE Developer
Posts
932
Karma
4
OS
frosch wrote:Could somebody be so kind and give me an example?


So I'll give it a try. One of my banks stores the name of the payee/receiver as the first 27 characters of the memo field. Sometimes, they don't do that and use even the first 27 characters for the memo (usually these are messages from the bank itself).

So here's what I have setup to cope with this:

Code: Select all
Payee:  (.{27})
Memo :  .{27}(.*)


The trick is to enclose the part you are interested in into parenthesis. http://doc.trolltech.com/4.6/qregexp.ht ... uring-text has more on that. So the above translates to:

  • Match 27 characters of any kind and extract them as payee.
  • Match 27 or more characters, skip the first 27 characters and use whatever is left as the memo part.

A dot in regexp's means 'any character'. An asterisk means 'zero or more occurrences'.

Also, I fill the exceptions list with the corresponding messages from the bank. They also can be regexp's.

In case you still have problems (this is after all not the easiest concept to understand - I am just doing it for so long now :) ), give us an example of what you get from the bank and we try to figure out the regexps for you. If you have a working setting, please drop a note here by naming the bank, so others benefit as well.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.1 64bit, KF5
frosch
Registered Member
Posts
8
Karma
0
Dear Christian, Dear ipwizard,

thanks for your replies! ipwizard's solution works fine for me:

ipwizard wrote:
Code: Select all
Payee:  (.{27})
Memo :  .{27}(.*)



I am trying to download the credit card information at PSD Bank. It seems the bank sends 108 chars, where 27 chars always represent one line and the first line is the payee.

Thanks for your support, Thomas

PS: In the meantime I have found some very good resources about regular expressions ...

German Tutorial: http://www.danielfett.de/internet-und-opensource,artikel,regulaere-ausdruecke
Online testing: http://rubular.com/
User avatar ipwizard
KDE Developer
Posts
932
Karma
4
OS
PSD and Sparda Bank use the same URL, so the regex's should be identical :)

Thanks for the links to the regex stuff. That should be helpful for others.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.1 64bit, KF5
frosch
Registered Member
Posts
8
Karma
0
I have to correct myself after playing around a little bit. For Credit Card information at PSD Bank, the following regular expressions work best:

Code: Select all
Payee: .{1,27}) [A-Z]{3} .*
Memo: .{1,27} ([A-Z]{3} .*)
Exception: ABRECHNUNG VOM .*


;)
User avatar ipwizard
KDE Developer
Posts
932
Karma
4
OS
If I spot that right, the opening parenthesis is missing in your payee entry ;)


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.1 64bit, KF5

 
Reply to topic

Bookmarks



Who is online

Registered users: alra, Baidu [Spider], Bing [Bot], bovender, claydoh, colstar, farid, flyingbear, Google [Bot], ipwizard, lbettini, Mace68, quisimodo, sandro4912, Sogou [Bot], TheraHedwig, Yahoo [Bot]