diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index 8127ae77..789226ba 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -1181,10 +1181,15 @@ bool perl_matcher::skip_until_paren(int index, { // Unenclosed closing ), occurs when (*ACCEPT) is inside some other // parenthesis which may or may not have other side effects associated with it. + const re_syntax_base* sp = pstate; match_endmark(); if(!pstate) { unwind(true); + // unwind may leave pstate NULL if we've unwound a forward lookahead, in which + // case just move to the next state and keep looking... + if (!pstate) + pstate = sp->next.p; } } continue;