[Kmymoney] Fwd: KMM - online quotation update
Thomas Baumgart
thb at net-bembel.de
Sun Sep 28 05:11:53 UTC 2014
Hi,
not sure if Pascal got this message, so I send it again with some minor
nitpicks included for Koos.
On Saturday 27 September 2014 22:18:27 Koos Pol wrote:
> 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).
Yes, but the symbol expression mentioned above is a bit different:
Symbol: ([^,]+),.+
The difference is the '*' vs '+'. We get to that in a minute.
> ^____________ [^,] 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.
That is what the '+' is good for (which is noted as a '1' in the line above
this comment). It means 'one or more'. An asterisk here would simply mean
'zero or more'.
> ^______ , 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
--
Regards
Thomas Baumgart
GPG-FP: E55E D592 F45F 116B 8429 4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
Flying is absolutely safe as long as you land as often
as you take off. -- Klaus Klages
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20140928/38d19669/attachment.sig>
More information about the KMyMoney
mailing list