Boost C++ Libraries: Ticket #3586: Use of Greedy quantifiers in Quoted Expressions locks up at regex compile https://svn.boost.org/trac10/ticket/3586 <p> The following will not compile: \Q.*\E and causes the program to lockup at the compile step. I have attempted other usages: '\Qh*\E', '\Q.+\E', '\Q+\E', '\Q*\E' etc. and they all lock-up on compile. Note that escaping the quantifier will allow it to compile (but it is a different expression): '\Q.\*\E' -- compiles but will only match '.\*' not '.*' </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/xpressive/xpressive.hpp&gt; using namespace boost::xpressive; int main() { std::string hello( "hello .* world!" ); std::cout &lt;&lt; "compile regex" &lt;&lt; std::endl; sregex rex = sregex::compile( "\\Q.*\\E" ); smatch what; std::cout &lt;&lt; "Get Iterator" &lt;&lt; std::endl; sregex_iterator cur( hello.begin(), hello.end(), rex ); sregex_iterator end; std::cout &lt;&lt; "begin search" &lt;&lt; std::endl; while( cur != end ) { smatch const &amp;what = *cur; std::cout &lt;&lt; "found: " &lt;&lt; what[0] &lt;&lt; '\n'; cur++; } return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3586 Trac 1.4.3 Eric Niebler Tue, 03 Nov 2009 23:45:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3586#comment:1 https://svn.boost.org/trac10/ticket/3586#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">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57346" title="fix infinite loop with some uses of \Q...\E quotemeta, fixes #3586">[57346]</a>) fix infinite loop with some uses of \Q...\E quotemeta, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3586" title="#3586: Bugs: Use of Greedy quantifiers in Quoted Expressions locks up at regex compile (closed: fixed)">#3586</a> </p> Ticket