summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex/RegexMatcher.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-07-09 09:33:02 -0400
committerLinus Groh <mail@linusgroh.de>2021-07-09 19:45:55 +0100
commit0f0ac37b56884f473637ad53defd7e4b6d8bc430 (patch)
treeaca66fa1403e6ddde5c898dda6d904ff9de45c53 /Userland/Libraries/LibRegex/RegexMatcher.h
parent3892b6e6ece8fd60ea592bf8c4f5674e99a544c8 (diff)
downloadserenity-0f0ac37b56884f473637ad53defd7e4b6d8bc430.zip
LibRegex: Break from execution loop when the sticky flag is set
If the sticky flag is set, the regex execution loop should break immediately even if the execution was a failure. The specification for several RegExp.prototype methods (e.g. exec and @@split) rely on this behavior.
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexMatcher.h')
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.h b/Userland/Libraries/LibRegex/RegexMatcher.h
index 5e3c63cf2c..57dad88535 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.h
+++ b/Userland/Libraries/LibRegex/RegexMatcher.h
@@ -149,6 +149,7 @@ public:
options.reset_flag(AllFlags::MatchNotEndOfLine);
options.reset_flag(AllFlags::MatchNotBeginOfLine);
}
+ options.reset_flag(AllFlags::Internal_Stateful);
options |= AllFlags::Global;
return matcher->match(view, options);
@@ -164,6 +165,7 @@ public:
options.reset_flag(AllFlags::MatchNotEndOfLine);
options.reset_flag(AllFlags::MatchNotBeginOfLine);
}
+ options.reset_flag(AllFlags::Internal_Stateful);
options |= AllFlags::Global;
return matcher->match(views, options);