C++14 regex class problem

Правка en1, от Ahmed_Mostafa, 2017-07-31 16:35:03

I was trying to solve a problem using c++ regex class but a runtime error occurred. I printed the exception and it was : "Number of NFA states exceeds limit. Please use shorter regex string, or use smaller brace expression, or make larger." (submission : http://codeforces.net/contest/832/submission/29048936)

the macro _GLIBCXX_REGEX_STATE_LIMIT is defined here: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/regex_automaton.h

as #define _GLIBCXX_REGEX_STATE_LIMIT 100000

For the specific problem I was trying to solve the pattern string I had to construct can exceed 100000 chars and so maybe when it gets converted to a NFA it will need more states,of course this is an internal header file and we don't have access to it so I can't include it and undefine the macro and redefine it with another limit.

Does anyone know how to change this limit ? the exception message clearly said "or make _GLIBCXX_REGEX_STATE_LIMIT larger." so there should be a way to change that limit.

Теги regular expressions, regex

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Ahmed_Mostafa 2017-07-31 16:35:03 1051 Initial revision (published)