[Kmymoney] Fwd: KMM - online quotation update
Koos Pol
kmymoney at pohw.nl
Sat Sep 27 20:18:27 UTC 2014
Pascal,
On 2014-09-27 12:04, pjp13 at free.fr wrote:
> What I would like is to retrieve in KMM quotations of equities whith
> codes such as FR0010287094.PA.
> KMM can retrieve quotations with code such as GSZ.PA from yahoo web
> page but not with code such as FR0010287094.PA which are not on yahoo
> web page but on yahoo france web page. Unfortunately when I chose
> Yahoo France in KMM config it doesn't find the quotation either (see
> attached screen captures).
The regexes from KMM assume Yahoo France uses a ; as column seperator.
In reality the column separator is ,
This means that by changing the the ; into , you're already half way
home.
With a few more minor modifications, the regexes look as follows for
Yahoo France:
Symbol : ([^,]+),.+
Price : [^,]+,([^,]+).+
Date : ^.+,(.+)
The one thing I'm uncertain of is the date. Becasue it's now Saturday,
the date turns up as "N/A".
You may need to add quotes (").
> Of course, I am also interested in any information that could help me
> to understand how to use regex.
Regexes are easy once you understand they are just as a simple foreign
language. Once you get to know the syntax and rules it's not that hard.
Even better, in contrast of a normal, human language, a regex is
unambiguous and follows the exact same rules each and every time.
I'll give you the breakdown of the symbol part:
FR0010187094.PA,0.00,"N/A"
Symbol: ([^,]*),.+
^_____________ () The string which matches the sub-pattern
between ( and )
will be remembered (and extracted by KMM).
^____________ [^,] A character from the list between [ ]. As
the list starts
with a ^ (meta char) , the statement
negated. Therefor
this translates to: Any character NOT equal
to ,
^________ 1 The previous item needs to match one or more
times.
^______ , followed by a comma
^_____ . any character
^____ + The previous item needs to match one or more
times.
This means the quote line will be dissected against the symbol regex as
follows:
FR0010187094.PA , 0.00,"N/A"
--------------- - ----------
There's an exellent online regext engine at http://www.regexr.com/
Here you can try out your own brew.
A pretty good tutorial is available from:
-dont-know-anything-about-regular-expressions-a-complete-guide--net-7869
Youtube also has some nice video tutorials.
Good luck!
Koos
More information about the KMyMoney
mailing list