Patterns like `^(a|a?)+$` build a split tree where each `a` can be
matched by either alternative. On short non-matching inputs that still
blows through the backtrack limit even though the two alternatives are
semantically equivalent to a single greedy optional matcher.
Detect the narrow case of two single-term alternatives that compile to
the same simple matcher, where one is required and the other is greedy
`?`, and compile them as that single optional term instead of emitting
a disjunction.
Add a String.prototype.match regression for
("a".repeat(25) + "b").match(/^(a|a?)+$/), which should return null
instead of throwing an InternalError.
|
||
|---|---|---|
| .. | ||
| Rust | ||
| CMakeLists.txt | ||
| ECMAScriptRegex.cpp | ||
| ECMAScriptRegex.h | ||
| RustRegex.cpp | ||
| RustRegex.h | ||