<div class="markdown_content"><ol>
<li>My vote is to add $ and ^ to the list, backwards compatibility be damned. </li>
<li>No, that's the whole set. Other characters with special meaning in PCRE are dependent on one of those (e.g. : is only special after ?)</li>
<li>No, there's another case of the same thing in do_XMLTag(). My inclination would be to define  CHARS_MAKING_REGEX_NONLITERAL as a macro used in both locations. </li>
</ol>
<hr/>
<p><strong> <a class="alink" href="https://sourceforge.net/p/cwb/bugs/74/">[bugs:#74]</a> Inconsistency in CQP regexp matching</strong></p>
<p><strong>Status:</strong> open<br/>
<strong>Group:</strong> TODO-3.5<br/>
<strong>Created:</strong> Sat Feb 12, 2022 09:21 AM UTC by Stefan Evert<br/>
<strong>Last Updated:</strong> Sat Feb 12, 2022 09:21 AM UTC<br/>
<strong>Owner:</strong> Andrew Hardie</p>
<p>The query <code>[pos="PP$"]</code> matches the Penn tag <code>PP$</code>, but queries <code>[pos="PP$"%c]</code> and <code>[pos="PP$|PP$"]</code> match <code>PP</code> instead.</p>
<p>The reason, of course, is that the first query is matched as a literal string rather than a regexp, so <code>$</code> isn't interpreted as a metacharacter anchoring the regexp at end-of-string. CQP heuristically checks for metacharacters in <code>do_flagged_string()&lt;cqp/parse_actions.c&gt;</code>, but the list doesn't include the “useless” metacharacters <code>$</code> and <code>^</code>.  This raises three questions:<br/>
1. Should we change behaviour to ensure consistency between the three queries? This might break existing applications (and users) who have unwittingly relied on the current inconsistent behaviour.<br/>
2. If we do, perhaps the current list <code>"[](){}.*+|?\\"</code> has further gaps?<br/>
3. Is <code>do_flagged_string()</code> the only place where this test is run or do we need to patch other functions as well?</p>
<hr/>
<p>Sent from sourceforge.net because cwb@sslmit.unibo.it is subscribed to <a href="https://sourceforge.net/p/cwb/bugs/">https://sourceforge.net/p/cwb/bugs/</a></p>
<p>To unsubscribe from further messages, a project admin can change settings at <a href="https://sourceforge.net/p/cwb/admin/bugs/options.">https://sourceforge.net/p/cwb/admin/bugs/options.</a>  Or, if this is a mailing list, you can unsubscribe from the mailing list.</p></div>