problem with online quotes/regexps in KMyMoney 5.0.5

Thomas Baumgart thb at net-bembel.de
Tue Aug 6 22:27:00 BST 2019


Geza,

On Dienstag, 6. August 2019 20:58:51 CEST Geza Giedke wrote:

> Dear Thomas,
> 
> thanks a lot for your help and the explanations regarding the syntax
> and sorry for the delay (I had a hard disk problem and had to
> reinstall the brand new Leap 15.1).

I went through similar problems lately ;) Though I could recover from a disc image.

> Yes, now things work for me. (Just for the record, I now realize that
> I messed things up during my trial-and-errors on the weekend: I
> mistyped the symbol as "PFE.FRA"  ("." instead of ":") and since then
> nothing worked anymore (of course). Once that's corrected,  also my
> expression
> 
> Price \(EUR\)</span><span class="mod-ui-data-list__value">([\d, ]+\.\d+)
> 
> matches the price.)
> 
> Do I inderstand your more concise expression
> ([\d\.,]+)
> correctly as matching "any uninterrupted sequence of digits, "." and ",""? 

Yes. The expression matches "one or more out of digit, period or comma". It matches also weird stuff like "1,,,.2" but hopefully that does not show up in this area. Yours would also allow blanks as e.g. thousand separator and only a single period. In case the blank is needed it could be added to my expression as well as part of the set.

> thanks again

You're welcome

Thomas



> On 8/5/19, Thomas Baumgart <thb at net-bembel.de> wrote:
> > Geza,
> >
> > here it comes:
> >
> > URL:    "https://markets.ft.com/data/equities/tearsheet/summary?s=%1"
> > Symbol: leave empty
> > Price:  "<span class="mod-ui-data-list__value">([\d\.,]+)</span>"
> > Date:   "as of (\w+ \d+ \d+) \d+:\d+.+T\.</div>"
> > Format: "%m %d %y"
> >
> > Mark the "Skip HTML stripping" option. If you don't have that marked, it
> > won't work because it verfies against some HTML tags and those will
> > otherwise be removed.
> >
> > Don't include the surrounding quotes I have used in the values above. I just
> > added them for better readability.
> >
> > Here's the output of the onlinequoteseditor from Alkimia:
> >
> > *URL found:
> > https://markets.ft.com/data/equities/tearsheet/summary?s=PFE:FRA...*
> > *Symbol found: ''*
> > *Price found: '33.20' (33.2)*
> > *Date found: 'Aug 05 2019'*
> > *Date format found: 'Aug 05 2019' -> 'Mo. Aug. 5 2019'*
> > PFE:FRA PFE:FRA Mo. Aug. 5 2019 33.2
> >
> > Hope that also works for you. Oh, and the double quotes: that only applies
> > if you enter the strings as C/C++ source code but not to the edit fields in
> > the application.
> >
> >
> > Regards
> >
> > Thomas
> >
> >
> > On Samstag, 3. August 2019 19:41:16 CEST Geza Giedke wrote:
> >
> >> Hello,
> >>
> >> after an upgrade from 4.8.2. to 5.0.5 (while moving from openSUSE 42.3
> >> to 15.1) my online quotes do not work anymore ("Unable to update price
> >> for PFE.FRA (no price or no date)") nor can I get any of the default
> >> sites for quotes to work.
> >>
> >> There must be some mistake in the regexps I'm using, but I can't find
> >> it (and when I tried them out at the RegExp tester
> >> (http://myregexp.com/) they did work. Any help would be appreciated.
> >> Maybe someone on this list can spot the mistake - I would be very
> >> grateful.
> >>
> >> I would like to continue using the data provided by FT, e.g.,
> >> https://markets.ft.com/data/equities/tearsheet/summary?s=PFE:FRA
> >>
> >> The page contains the price in the form
> >>
> >> Price (EUR)</span><span class="mod-ui-data-list__value">34.40</span>
> >>
> >> which I used to to match with
> >>
> >> Price\\s\\(\\w+\\)</span><span
> >> class="mod-ui-data-list__value">(\\d?\\,?\\d+\\.\\d+)</span>
> >>
> >> (I used double \\ because of the explanation "To include a \ in a
> >> regexp, enter it twice, i.e. \\. To match the backslash character
> >> itself, enter it four times, i.e. \\\\." given on the QtRegExp-Help
> >> page (https://doc.qt.io/archives/qt-4.8/qregexp.html#code-examples),
> >> but I also tried out several variants of the above without doubling
> >> the backslashes (since the default entries in KMyMoney use single
> >> slashes only) such as:
> >>
> >> Price \(EUR\)</span><span class="mod-ui-data-list__value">([\d, ]+\.\d+)
> >>
> >> but the result is always the same. To see that I can match at least
> >> something, I tried
> >>
> >> utf-(\d)
> >>
> >> which then indeed gives "8" -- the only "expected" result I could
> >> produce.
> >>
> >> The date comes as
> >>
> >> as of Aug 02 2019 17:04 BST.</div>
> >>
> >> which I used to match with
> >>
> >> as of (\\w+\\s\\d+\\s\\d+)\\s\\d+:\\d+\\sBST
> >>
> >> or with
> >>
> >> as of (\w+ \d+ \d+)
> >>
> >> But now I always get "(no price or no date)". What am I doing wrong?
> >>
> >> The new KMyMoney also seems to require to extract the identifier from
> >> the file (which seems weird since it's already used to identify the
> >> file); I use
> >>
> >> /data/equities/tearsheet/charts\?s=(\w+:\w+)
> >>
> >> for this; when I leave the corresponding line empty The response
> >> changes slightly, including also a "Identifier found: ''"
> >> before the "(no price or no date)" line.
> >>
> >> Is there some way in which I can see/debug how the RegExp I'm using is
> >> being matched?
> >>
> >> Thanks a lot for your time and help.
> >>
> >> best regards
> >>  Geza
> >>
> >
> > --
> >
> > Regards
> >
> > Thomas Baumgart
> >
> > https://www.signal.org/       Signal, the better WhatsApp
> > -------------------------------------------------------------
> > Why do programmers wear glasses?
> > Cause they don't C#.
> > -------------------------------------------------------------
> >
> >
> 

-- 

Regards

Thomas Baumgart

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
-------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20190806/0811ff66/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney/attachments/20190806/0811ff66/attachment-0001.sig>


More information about the KMyMoney mailing list