LibRegex: Allow the pattern to match the zero-length end of the string

...only if Multiline is not enabled.
Fixes #11940.
This commit is contained in:
Ali Mohammad Pur 2022-01-21 14:50:30 +03:30 committed by Ali Mohammad Pur
commit 9eccd4c56e
Notes: sideshowbarker 2024-07-17 20:32:07 +09:00
2 changed files with 5 additions and 1 deletions

View file

@ -683,6 +683,7 @@ TEST_CASE(ECMA262_match)
{ "[\\01]"sv, "\1"sv, true, ECMAScriptFlags::BrowserExtended },
{ "(\0|a)"sv, "a"sv, true }, // #9686, Should allow null bytes in pattern
{ "(.*?)a(?!(a+)b\\2c)\\2(.*)"sv, "baaabaac"sv, true }, // #6042, Groups inside lookarounds may be referenced outside, but their contents appear empty if the pattern in the lookaround fails.
{ "a|$"sv, "x"sv, true, (ECMAScriptFlags)regex::AllFlags::Global }, // #11940, Global (not the 'g' flag) regexps should attempt to match the zero-length end of the string too.
};
// clang-format on