The following code (win10, target plateform version = 10.0.17134.0, platform toolset = Visual Studio 2015 (v140) in latest update of visual studio 2019 pro, debug x64) :
#include <iostream>
//#define _REGEX_MAX_STACK_COUNT 0;
#include <regex>
int main()
{
int stack_reg = _REGEX_MAX_STACK_COUNT ;
std::string nok("FDFDFD...FDFD"); // concatenation of "FD" 298 times
std::string ok( "FDDFFD...FD"); // concatenation of "FD" 297 times
auto regex(std::regex("([FI]D){1,}"));
bool res_ok = std::regex_match(ok, regex);
bool res_nok = std::regex_match(nok, regex); // triggers the exception
return 0;
}
triggers the following exception :
inside C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xmemory0
when line bool res_nok = std::regex_match(nok, regex); // triggers the exception
is trying to be executed.
Setting _REGEX_MAX_STACK_COUNT
to 200000 or even to 0 (no limit) keeps triggering the same exception.
I tried to apply solution from
https://stackoverflow.com/a/42913977/1581875
but I have no "regex.h" in my include paths so that I can only include .
(Context : the code is one case
from thousands in a switch...case
parsing a huge programming language script, so that I would ideally like to do the very same regex with the very same matching pattern in a different way. The problem is that installing boost is not an option for me.)
Aucun commentaire:
Enregistrer un commentaire