mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 15:07:44 +00:00
LibRegex: Don't ignore empty alternatives in append_alternation()
Doing so would cause patterns like `(a|)` to not match the empty string.
This commit is contained in:
parent
7ee409ef98
commit
ac856cb965
2 changed files with 17 additions and 6 deletions
|
@ -898,6 +898,7 @@ TEST_CASE(optimizer_atomic_groups)
|
|||
// Alternative fuse
|
||||
Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true },
|
||||
Tuple { "(a|a)"sv, "a"sv, true },
|
||||
Tuple { "(a|)"sv, ""sv, true }, // Ensure that empty alternatives are not outright removed
|
||||
// ForkReplace shouldn't be applied where it would change the semantics
|
||||
Tuple { "(1+)\\1"sv, "11"sv, true },
|
||||
Tuple { "(1+)1"sv, "11"sv, true },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue