Boost C++ Libraries: Ticket #4309: Negative lookbehind assertion error https://svn.boost.org/trac10/ticket/4309 <p> As soon as you include an OR-expression inside a negative lookbehind assertion, you get wrong results. Not sure if this is a bug, but I've tested this with multiple engines and I get different results. </p> <hr /> <p> Regex: (?&lt;!foo|bar) \( </p> <p> String: test bar ( </p> <p> NO MATCH (expected) </p> <hr /> <p> Regex: (?&lt;!food|bar) \( </p> <p> String: test bar ( </p> <p> MATCH (NOT expected) </p> <hr /> <p> Regex: (?&lt;!fo|bar) \( </p> <p> String: test bar ( </p> <p> MATCH (NOT expected) </p> <hr /> <p> This really makes it hard to match certain strings :( </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4309 Trac 1.4.3 Steven Watanabe Mon, 07 Jun 2010 23:33:22 GMT <link>https://svn.boost.org/trac10/ticket/4309#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4309#comment:1</guid> <description> <p> According to <a class="ext-link" href="http://perldoc.perl.org/perlre.html#Extended-Patterns"><span class="icon">​</span>http://perldoc.perl.org/perlre.html#Extended-Patterns</a>, the latter two are not allowed. (I believe that the default behavior of Boost.Regex is to match perl) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 08 Jun 2010 10:20:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4309#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4309#comment:2</guid> <description> <p> I wouldn't be too sure. </p> <p> (?&lt;!pattern) A zero-width negative look-behind assertion. For example /(?&lt;!bar)foo/ matches any occurrence of "foo" that does not follow "bar". <strong>Works only for fixed-width look-behind</strong>. </p> <p> Both foo and bar are fixed-width, so ORing them should also be fixed width. There is no quantifier used in the sample. </p> <p> For comparison, in .NET, System.Text.<a class="missing wiki">RegularExpressions</a>.Regex does it 'right'. The .NET regular expression engine is designed to be mostly compatible with Perl 5 regular expressions. Hmmm? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 08 Jun 2010 12:20:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4309#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4309#comment:3</guid> <description> <p> Expressions 2 and 3 should have been rejected - they're not supported either by Perl or by Boost.Regex. Will fix shortly, John. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 08 Jun 2010 12:41:46 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4309#comment:4 https://svn.boost.org/trac10/ticket/4309#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62563" title="Some lookbehind assertions were accepted when they should not have ...">[62563]</a>) Some lookbehind assertions were accepted when they should not have been. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4309" title="#4309: Bugs: Negative lookbehind assertion error (closed: fixed)">#4309</a>. </p> Ticket