<?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[QRegExp Global Flag]]></title><description><![CDATA[<p dir="auto">Is there any way to set the <code>global</code> flag for a regular expression using <code>QRegExp</code>?</p>
<p dir="auto">This pattern:</p>
<p dir="auto"><code>\(([^()]*)\)</code></p>
<p dir="auto">Matching against the following:</p>
<pre><code>(((119.7500182 25.3, 119.7730556 25.3, 119.7730556 25.3833333, 119.9672222 25.3833333, 119.9672222 25.1583333, 119.6125 25.1583333, 119.6125 25.3, 119.7500182 25.3)), ((119.8672912 25.8163889, 119.9672222 25.8163889, 119.9672222 25.6916667, 119.8561111 25.6916667, 119.8561111 25.8163889, 119.8672912 25.8163889)), ((119.4675 25.6008704, 119.4675 25.8163889, 119.5633333 25.8163889, 119.5633333 25.65, 119.5833333 25.65, 119.5833333 25.4805556, 119.6033333 25.4805556, 119.6033333 25.4316667, 119.4675 25.4316667, 119.4675 25.6008704)))
</code></pre>
<p dir="auto">Should produce 3 capture groups (well, when testing on various online RegEx processors) however Qt only manages 1 capture group.</p>
<p dir="auto">Disabling the <code>global</code> flag on the various online processors replicates the same behaviour as Qt.</p>
]]></description><link>https://forum.qt.io/topic/92555/qregexp-global-flag</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 07:45:58 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/92555.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Jul 2018 09:34:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QRegExp Global Flag on Fri, 13 Jul 2018 11:01:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> Works like a treat, thanks for your help. I shall no longer use <code>QRegExp</code>. Thanks again</p>
]]></description><link>https://forum.qt.io/post/469318</link><guid isPermaLink="true">https://forum.qt.io/post/469318</guid><dc:creator><![CDATA[webzoid]]></dc:creator><pubDate>Fri, 13 Jul 2018 11:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to QRegExp Global Flag on Thu, 12 Jul 2018 12:20:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/webzoid">@<bdi>webzoid</bdi></a><br />
It's probably the best idea anyway.  Then <em>hopefully</em> you will see your pattern work exactly as per Perl, which you've probably checked in your regular expression tester as doing what you want.</p>
]]></description><link>https://forum.qt.io/post/469148</link><guid isPermaLink="true">https://forum.qt.io/post/469148</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 12 Jul 2018 12:20:59 GMT</pubDate></item><item><title><![CDATA[Reply to QRegExp Global Flag on Thu, 12 Jul 2018 12:15:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> I'll move my code over to the <code>QRegularExpression</code> class as you've mentioned.</p>
]]></description><link>https://forum.qt.io/post/469144</link><guid isPermaLink="true">https://forum.qt.io/post/469144</guid><dc:creator><![CDATA[webzoid]]></dc:creator><pubDate>Thu, 12 Jul 2018 12:15:05 GMT</pubDate></item><item><title><![CDATA[Reply to QRegExp Global Flag on Thu, 12 Jul 2018 11:52:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/webzoid">@<bdi>webzoid</bdi></a><br />
I don't know what the code of "regexp Qt example project" does, one way or the other.  You'd have to look at it to see what it's doing &amp; reporting.</p>
<p dir="auto">However, can't you change over the recommended <code>QRegularExpression</code>class I mentioned?  Since that states it's Perl-compatible, you'll know its behaviour is as per when you have looked at Perl flavor regular expressions.</p>
]]></description><link>https://forum.qt.io/post/469137</link><guid isPermaLink="true">https://forum.qt.io/post/469137</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 12 Jul 2018 11:52:32 GMT</pubDate></item><item><title><![CDATA[Reply to QRegExp Global Flag on Thu, 12 Jul 2018 10:02:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> Unfortunately, I'm not getting the captures - well, not all 3 as I expect.</p>
<p dir="auto">The reason I <em>expect</em> them is that when testing using the online tools (using various RegEx "flavours"), I get 3 captures. Here's a link showing just that:</p>
<p dir="auto"><a href="https://regex101.com/r/ZlzWNM/3" target="_blank" rel="noopener noreferrer nofollow ugc">https://regex101.com/r/ZlzWNM/3</a></p>
<p dir="auto">If I then try the same pattern and text in the <code>regexp</code> Qt example project, I only get 1 capture.</p>
]]></description><link>https://forum.qt.io/post/469117</link><guid isPermaLink="true">https://forum.qt.io/post/469117</guid><dc:creator><![CDATA[webzoid]]></dc:creator><pubDate>Thu, 12 Jul 2018 10:02:15 GMT</pubDate></item><item><title><![CDATA[Reply to QRegExp Global Flag on Thu, 12 Jul 2018 09:42:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/webzoid">@<bdi>webzoid</bdi></a> said in <a href="/post/469105">QRegExp Global Flag</a>:</p>
<p dir="auto">Various ways, e.g. <a href="http://doc.qt.io/qt-5/qregexp.html#cap" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qregexp.html#cap</a>, <a href="http://doc.qt.io/qt-5/qregexp.html#capturedTexts" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qregexp.html#capturedTexts</a>.  You don't <em>specify</em> "global", you get the captures anyway.  So what makes you say "Should produce 3 capture groups [but does not]"?</p>
<p dir="auto">Also (since someone else will doubtless say this to you):</p>
<blockquote>
<p dir="auto">Note: In Qt 5, the new QRegularExpression class provides a Perl compatible implementation of regular expressions and is recommended in place of QRegExp.</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/469108</link><guid isPermaLink="true">https://forum.qt.io/post/469108</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 12 Jul 2018 09:42:42 GMT</pubDate></item></channel></rss>