From f01ce3276e1d5ade07107d25ddab04117ad40be8 Mon Sep 17 00:00:00 2001 From: Zher Huei Lee Date: Mon, 26 Jun 2017 15:25:10 +0800 Subject: [PATCH] Fixed inverted group thrown off by quantifiers --- modules/regex/regex.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index c095291aea39..c728657d6b3a 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -603,10 +603,8 @@ struct RegExNodeGroup : public RegExNode { int res = childset[i]->test(s, pos); - if (s.complete) - return res; - if (inverse) { + s.complete = false; if (res < 0) res = pos + 1; else @@ -616,6 +614,9 @@ struct RegExNodeGroup : public RegExNode { continue; } + if (s.complete) + return res; + if (res >= 0) { if (reset_pos) res = pos;