mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
Analyze parsed patterns for literal substrings that every match must contain and feed the longest one into the existing required-literal hint. This lets the VM reject obvious misses for optional-prefix extractors, literal-prefix parsers, and common-substring alternations without adding more shape-specific fast paths. Use ASCII case-insensitive probes when the required literal comes from a legacy `/i` pattern, and skip modifier groups that change ignore-case so the hint does not over-constrain scoped flag behavior. Keep the analysis within the same 64-code-unit budget that the VM hint already uses so large fixed quantifiers and long literal alternations do not blow up compile time. Add TestRegex coverage for assignment extractors, ASCII ignore- case prefilters, common-substring alternations, and the compile- time regression shapes. TestRegex passes, the long-pattern js probes behave correctly, and regex benchmark spot checks stay fast.