Boost C++ Libraries: Ticket #3459: Xpressive - Redundant search pattern causes fatal crash https://svn.boost.org/trac10/ticket/3459 <p> Using Xpressive with dynamic regexes. </p> <p> If a ':' appears two times in a search pattern expression the programm will crash. </p> <p> One ':' must be at the very beginning the other at the end of the expression. </p> <p> This may hold true for other cases, however not tested yet. </p> <p> #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;boost/xpressive/xpressive.hpp&gt; </p> <p> using namespace std; using namespace boost; using namespace boost::xpressive; </p> <p> int main() { </p> <blockquote> <p> sregex rex = sregex::compile( "[:digit:]" ); </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3459 Trac 1.4.3 Eric Niebler Thu, 17 Sep 2009 04:04:18 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3459#comment:1 https://svn.boost.org/trac10/ticket/3459#comment:1 <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">invalid</span> </li> </ul> <p> "[:digit:]" is an invalid regular expression. The code is not crashing. It is throwing an exception, as it should. You probably meant: "<a class="missing wiki">:digit:</a>". </p> Ticket master.universe@… Thu, 17 Sep 2009 10:01:32 GMT cc set https://svn.boost.org/trac10/ticket/3459#comment:2 https://svn.boost.org/trac10/ticket/3459#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">master.universe@…</span> added </li> </ul> <p> Well. But why does [:digit<strong>:</strong>] throw but [:digi<strong>:</strong>t] does _not_? No. I really ment [:digit:] . For my favour to be interpreted as possbile match pattern - right? </p> Ticket Eric Niebler Thu, 17 Sep 2009 16:05:41 GMT <link>https://svn.boost.org/trac10/ticket/3459#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3459#comment:3</guid> <description> <p> A pattern may contain a character set (which begins with <code>'['</code> and ends with <code>']'</code>). A character set may contain a nested posix character set (which begins with "[:" and ends with ":]"). Xpressive's regex parser sees the leading '[' and parses the rest as a character set containing the characters ':', 'd', 'i', 'g', 'i', and 't' (very much not what you want, but perfectly correct according to the ECMA-262 specification). Now it reads ":]" as a single token and, having found a closing posix charset bracket without an opening one, it throws an exception. </p> <p> I repeat: you meant "<a class="missing wiki">:digit:</a>". If you still disagree, please back up your argument with the relevant portion of ECMA-262. </p> </description> <category>Ticket</category> </item> </channel> </rss>