1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

LibRegex+LibJS: Avoid searching for more than one match in JS RegExps

All of JS's regular expression APIs only want a single match, so avoid
trying to produce more (which will be discarded anyway).
This commit is contained in:
Ali Mohammad Pur 2022-02-04 19:29:26 +03:30 committed by Andreas Kling
parent 4c506f91fe
commit 2b028f6faa
5 changed files with 28 additions and 5 deletions

View file

@ -33,6 +33,7 @@ enum class AllFlags {
Sticky = __Regex_Sticky, // Force the pattern to only match consecutive matches from where the previous match ended.
Multiline = __Regex_Multiline, // Handle newline characters. Match each line, one by one.
SkipTrimEmptyMatches = __Regex_SkipTrimEmptyMatches, // Do not remove empty capture group results.
SingleMatch = __Regex_SingleMatch, // Stop after acquiring a single match.
Internal_Stateful = __Regex_Internal_Stateful, // Make global matches match one result at a time, and further match() calls on the same instance continue where the previous one left off.
Internal_BrowserExtended = __Regex_Internal_BrowserExtended, // Only for ECMA262, Enable the behaviors defined in section B.1.4. of the ECMA262 spec.
Internal_ConsiderNewline = __Regex_Internal_ConsiderNewline, // Only for ECMA262, Allow multiline matches to consider newlines as line boundaries.