<div dir="ltr"><div dir="ltr"><div>I did it using this:</div><div>string(REGEX MATCH "Bankleitzahlendateien - gültig vom ([^ ]*)" FILE_DATE  "${DATA}")<br>    if(FILE_DATE)<br>        string(REPLACE "Bankleitzahlendateien - gültig vom " "" FILE_DATE "${FILE_DATE}")<br>    endif()</div><div><br></div><div>But anyway, thanks. It will help me next time.</div><div>BTW is this feature mentioned somewhere in the CMake documentation?<br></div><div><br></div><div>Thanks.</div><div>Prasun<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 11 Jun 2020 at 03:48, Thomas Baumgart <<a href="mailto:thb@net-bembel.de">thb@net-bembel.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div style="font-family:"Monospace";font-size:10pt;font-weight:400;font-style:normal">
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">On Mittwoch, 3. Juni 2020 17:15:59 CEST Prasun Kumar wrote:</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">> Hi mentors,</p>
<p style="margin:0px;text-indent:0px">> Following up on my previous email:</p>
<p style="margin:0px;text-indent:0px">> <a href="https://mail.kde.org/pipermail/kde-finance-apps/2020-June/000851.html" target="_blank">https://mail.kde.org/pipermail/kde-finance-apps/2020-June/000851.html</a> I</p>
<p style="margin:0px;text-indent:0px">> have an idea to get the date for the valid_upto field.</p>
<p style="margin:0px;text-indent:0px">> Currently, the src/bankdata/CMakeLists.txt file contains the code to</p>
<p style="margin:0px;text-indent:0px">> download the webpage</p>
<p style="margin:0px;text-indent:0px">> <a href="https://www.bundesbank.de/de/aufgaben/unbarer-zahlungsverkehr/serviceangebot/bankleitzahlen/download-bankleitzahlen-602592" target="_blank">https://www.bundesbank.de/de/aufgaben/unbarer-zahlungsverkehr/serviceangebot/bankleitzahlen/download-bankleitzahlen-602592</a></p>
<p style="margin:0px;text-indent:0px">> (at lines 6-12) and uses a regex to search for 'blz-aktuell-txt-data.txt'</p>
<p style="margin:0px;text-indent:0px">> to scrape the link of the file. Now, this <a> tag has the label which</p>
<p style="margin:0px;text-indent:0px">> contains the date up to which the deletions were valid. We can scrape this</p>
<p style="margin:0px;text-indent:0px">> date from this label using another regex and save this date as a suffix for</p>
<p style="margin:0px;text-indent:0px">> the name of the file downloaded. This could then later be used to update</p>
<p style="margin:0px;text-indent:0px">> the valid_upto column.</p>
<p style="margin:0px;text-indent:0px">> Does this approach seem good enough?</p>
<p style="margin:0px;text-indent:0px">> </p>
<p style="margin:0px;text-indent:0px">> I think REGEX MATCH should be used here as the first occurrence of</p>
<p style="margin:0px;text-indent:0px">> "Bankleitzahlendateien - gültig vom" has the required date.</p>
<p style="margin:0px;text-indent:0px">> </p>
<p style="margin:0px;text-indent:0px">> I am currently having a problem in working out the regex. Generally, to</p>
<p style="margin:0px;text-indent:0px">> match a pattern after a string using regex, we use parentheses. But it is</p>
<p style="margin:0px;text-indent:0px">> not working with CMake regex. Can anyone help me here?</p>
<p style="margin:0px;text-indent:0px">> The line I have added looks like this:</p>
<p style="margin:0px;text-indent:0px">> </p>
<p style="margin:0px;text-indent:0px">> >    string(REGEX MATCH \"Bankleitzahlendateien - gültig vom ([^ ]*)\"</p>
<p style="margin:0px;text-indent:0px">> > FILE_DATE  \"\${DATA}\")</p>
<p style="margin:0px;text-indent:0px">> </p>
<p style="margin:0px;text-indent:0px">> </p>
<p style="margin:0px;text-indent:0px">> The FILE_DATE then contains "Bankleitzahlendateien - gültig vom 09.03.2020"</p>
<p style="margin:0px;text-indent:0px">> while I want only the pattern inside parentheses.</p>
<p style="margin:0px;text-indent:0px">> I want to fetch the first date after "Bankleitzahlendateien - gültig vom "</p>
<p style="margin:0px;text-indent:0px">> string.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Well, FILE_DATE contains the match, and that is what it contains. You want</p>
<p style="margin:0px;text-indent:0px">to use CMAKE_MATCH_# to get the matches in parenthesis. Here's a small test:</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">cmake_minimum_required(VERSION 3.10)</p>
<p style="margin:0px;text-indent:0px">set(DATA "Bankleitzahlendateien - gültig vom 09.03.2020")</p>
<p style="margin:0px;text-indent:0px">string(REGEX MATCH "^Bankleitzahlendateien - gültig vom ([^ ]*)$" FILE_DATE ${DATA})</p>
<p style="margin:0px;text-indent:0px">message("FILE_DATE:" ${FILE_DATE})</p>
<p style="margin:0px;text-indent:0px">message("CMAKE_MATCH_0:" ${CMAKE_MATCH_0})</p>
<p style="margin:0px;text-indent:0px">message("CMAKE_MATCH_1:" ${CMAKE_MATCH_1})</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">${CMAKE_MATCH_1} contains the date only.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">> Also, how to make CMake regex non-greedy?</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">I honestly don't know. The docs are sparse at that point.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">> I would appreciate some help as I am stuck here and the rest of my week's</p>
<p style="margin:0px;text-indent:0px">> work requires the database.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Hope I am not too late for the game.</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">-- </p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Regards</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px">Thomas Baumgart</p>
<p style="margin:0px;text-indent:0px"> </p>
<p style="margin:0px;text-indent:0px"><a href="https://www.signal.org/" target="_blank">https://www.signal.org/</a>       Signal, the better WhatsApp</p>
<p style="margin:0px;text-indent:0px">-------------------------------------------------------------</p>
<p style="margin:0px;text-indent:0px">Q: What did the drummer name his twin daughters? A: Anna one ... Anna Two ...</p>
<p style="margin:0px;text-indent:0px">-------------------------------------------------------------</p>
<p style="margin:0px;text-indent:0px"> </p></div></blockquote></div></div>