<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[An one liner to unpack QRegularExpressionMatch results into multiple variable?]]></title><description><![CDATA[<p dir="auto">I have a <code>QRegularExpression</code> object that captures multiple groups from strings, and a <code>QRegularExpressionMatch::capture(n)</code> to split them out individually.</p>
<p dir="auto">Is there an one liner like in python where I can unpack them all at once like this instead of one at a time?</p>
<pre><code>[id, name, type, text] = infoREMatch.capture();
</code></pre>
]]></description><link>https://forum.qt.io/topic/117180/an-one-liner-to-unpack-qregularexpressionmatch-results-into-multiple-variable</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 17:03:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/117180.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 20 Jul 2020 11:09:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to An one liner to unpack QRegularExpressionMatch results into multiple variable? on Mon, 20 Jul 2020 14:58:05 GMT]]></title><description><![CDATA[<p dir="auto">You could write a wrapper that returns tuples and use tie to place in separate vars:<br />
<a href="https://www.geeksforgeeks.org/how-to-return-multiple-values-from-a-function-in-c-or-cpp/" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.geeksforgeeks.org/how-to-return-multiple-values-from-a-function-in-c-or-cpp/</a><br />
Scroll to the tuple example.  Yes Python has some nice things.  I would really love comprehensions in C++.</p>
]]></description><link>https://forum.qt.io/post/607832</link><guid isPermaLink="true">https://forum.qt.io/post/607832</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Mon, 20 Jul 2020 14:58:05 GMT</pubDate></item><item><title><![CDATA[Reply to An one liner to unpack QRegularExpressionMatch results into multiple variable? on Mon, 20 Jul 2020 14:52:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lansing">@<bdi>lansing</bdi></a> said in <a href="/post/607825">An one liner to unpack QRegularExpressionMatch results into multiple variable?</a>:</p>
<blockquote>
<p dir="auto">But still it couldn't be unpack.</p>
</blockquote>
<p dir="auto">?  In C++ it's like a one-line function wrapper.  Yes, C++ isn't the same as Python.  Thank goodness!  Use Python + PySide2/PyQt5 if you prefer what you can do there over C++.</p>
]]></description><link>https://forum.qt.io/post/607831</link><guid isPermaLink="true">https://forum.qt.io/post/607831</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 20 Jul 2020 14:52:36 GMT</pubDate></item><item><title><![CDATA[Reply to An one liner to unpack QRegularExpressionMatch results into multiple variable? on Mon, 20 Jul 2020 14:20:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">I was using this one now, it's a little bit better in mass control like trimming all elements at once. But still it couldn't be unpack.</p>
]]></description><link>https://forum.qt.io/post/607825</link><guid isPermaLink="true">https://forum.qt.io/post/607825</guid><dc:creator><![CDATA[lansing]]></dc:creator><pubDate>Mon, 20 Jul 2020 14:20:09 GMT</pubDate></item><item><title><![CDATA[Reply to An one liner to unpack QRegularExpressionMatch results into multiple variable? on Mon, 20 Jul 2020 12:54:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lansing">@<bdi>lansing</bdi></a><br />
The closest is <code>QStringList QRegularExpressionMatch::capturedTexts() const</code>.</p>
]]></description><link>https://forum.qt.io/post/607819</link><guid isPermaLink="true">https://forum.qt.io/post/607819</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 20 Jul 2020 12:54:21 GMT</pubDate></item><item><title><![CDATA[Reply to An one liner to unpack QRegularExpressionMatch results into multiple variable? on Mon, 20 Jul 2020 12:48:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lansing">@<bdi>lansing</bdi></a> said in <a href="/post/607802">An one liner to unpack QRegularExpressionMatch results into multiple variable?</a>:</p>
<blockquote>
<p dir="auto">Is there an one liner like in python where I can unpack them all at once</p>
</blockquote>
<p dir="auto">No, there is not</p>
]]></description><link>https://forum.qt.io/post/607815</link><guid isPermaLink="true">https://forum.qt.io/post/607815</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 20 Jul 2020 12:48:09 GMT</pubDate></item></channel></rss>