Using regex to extract date for valid_upto field from bank's webpage

Prasun Kumar prasun.code at gmail.com
Wed Jun 3 16:15:59 BST 2020


Hi mentors,
Following up on my previous email:
https://mail.kde.org/pipermail/kde-finance-apps/2020-June/000851.html I
have an idea to get the date for the valid_upto field.
Currently, the src/bankdata/CMakeLists.txt file contains the code to
download the webpage
https://www.bundesbank.de/de/aufgaben/unbarer-zahlungsverkehr/serviceangebot/bankleitzahlen/download-bankleitzahlen-602592
(at lines 6-12) and uses a regex to search for 'blz-aktuell-txt-data.txt'
to scrape the link of the file. Now, this <a> tag has the label which
contains the date up to which the deletions were valid. We can scrape this
date from this label using another regex and save this date as a suffix for
the name of the file downloaded. This could then later be used to update
the valid_upto column.
Does this approach seem good enough?

I think REGEX MATCH should be used here as the first occurrence of
"Bankleitzahlendateien - gültig vom" has the required date.

I am currently having a problem in working out the regex. Generally, to
match a pattern after a string using regex, we use parentheses. But it is
not working with CMake regex. Can anyone help me here?
The line I have added looks like this:

>    string(REGEX MATCH \"Bankleitzahlendateien - gültig vom ([^ ]*)\"
> FILE_DATE  \"\${DATA}\")


The FILE_DATE then contains "Bankleitzahlendateien - gültig vom 09.03.2020"
while I want only the pattern inside parentheses.
I want to fetch the first date after "Bankleitzahlendateien - gültig vom "
string.
Also, how to make CMake regex non-greedy?
I looked up online but did not find any helpful resource.

I would appreciate some help as I am stuck here and the rest of my week's
work requires the database.

Thanks.
Prasun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20200603/b02b17f4/attachment.htm>


More information about the Kde-finance-apps mailing list