[Boost-bugs] [Boost C++ Libraries] #3586: Use of Greedy quantifiers in Quoted Expressions locks up at regex compile

Subject: [Boost-bugs] [Boost C++ Libraries] #3586: Use of Greedy quantifiers in Quoted Expressions locks up at regex compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-03 15:20:39


#3586: Use of Greedy quantifiers in Quoted Expressions locks up at regex compile
------------------------------------+---------------------------------------
 Reporter: nmaximillian@… | Owner: eric_niebler
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: xpressive
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: |
------------------------------------+---------------------------------------
 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 '.*'


 {{{
 #include <iostream>
 #include <boost/xpressive/xpressive.hpp>

 using namespace boost::xpressive;

 int main()
 {
     std::string hello( "hello .* world!" );

     std::cout << "compile regex" << std::endl;
     sregex rex = sregex::compile( "\\Q.*\\E" );
     smatch what;

     std::cout << "Get Iterator" << std::endl;
     sregex_iterator cur( hello.begin(), hello.end(), rex );
     sregex_iterator end;

     std::cout << "begin search" << std::endl;
     while( cur != end ) {
         smatch const &what = *cur;
         std::cout << "found: " << what[0] << '\n';
         cur++;
     }

     return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3586>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC