boost::regex: regex_constants::error_space

Hi, The code looks like: std::string buffer(10240, '\0'); // ... fill buffer boost::regex e("#1.*#7"); boost::smatch m; boost::regex_search(buffer, m, e); The buffer of 10KB is full of "something #x". As result I receive regex_constants::error_space at boost\regex\v4\perl_matcher_non_recursive.hpp:164. I'll highly appreciate any help. Thank you, Andriy Tylychko, telya@vichnavich.com

Andriy Tylychko (mail.ru) wrote:
Hi,
The code looks like:
std::string buffer(10240, '\0'); // ... fill buffer boost::regex e("#1.*#7"); boost::smatch m; boost::regex_search(buffer, m, e);
The buffer of 10KB is full of "something #x". As result I receive regex_constants::error_space at boost\regex\v4\perl_matcher_non_recursive.hpp:164. I'll highly appreciate any help.
You shouldn't get that exception from that expression: that exception is raised when the number of states visted in the search for a match looks to be growing exponentially, it's usually caused by "pathological" regular expressions like "(.*)*" that can end up searching forever on some inputs. Do you have a more specific test case please? John.
participants (2)
-
Andriy Tylychko (mail.ru)
-
John Maddock