diff --git a/include/boost/regex/v5/perl_matcher_non_recursive.hpp b/include/boost/regex/v5/perl_matcher_non_recursive.hpp index 28d6c462..92f6eb62 100644 --- a/include/boost/regex/v5/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v5/perl_matcher_non_recursive.hpp @@ -1204,7 +1204,10 @@ bool perl_matcher::skip_until_paren(int index, else if(pstate->type == syntax_element_startmark) { int idx = static_cast(pstate)->index; - pstate = pstate->next.p; + if(idx > 0) + match_startmark(); + else + pstate = pstate->next.p; skip_until_paren(idx, false); continue; } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index a2f6bba9..1fd6cc3d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -135,3 +135,4 @@ compile test_windows_defs_3.cpp ; compile test_windows_defs_4.cpp ; run issue153.cpp : : : "msvc:-STACK:2097152" ; +run issue227.cpp ; diff --git a/test/issue227.cpp b/test/issue227.cpp new file mode 100644 index 00000000..fce7fb52 --- /dev/null +++ b/test/issue227.cpp @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2024 +* Christian Mazakas +* +* Use, modification and distribution are subject to the +* Boost Software License, Version 1.0. (See accompanying file +* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +* +*/ + +#include +#include + +int main() { + boost::regex rx("(*ACCEPT)*+\\1((*ACCEPT)*+\\K)"); + std::string str = "Z"; + boost::smatch what; + boost::regex_search(str, what, rx, boost::match_default | boost::match_partial); +}