Linear Matching of JavaScript Regular Expressions
summary
Presents a proof that a much larger subset of JavaScript regexes admits linear-time matching, identifies semantic bugs and superlinear cases in V8’s linear engine, and delivers concrete fixes: a two-copy NFA construction to enforce JavaScript’s star semantics, a precomputed lookaround table plus single-replay reconstruction for capture groups, and a prototype engine called regel with several patches merged into V8. Implements and benchmarks the algorithms, showing linear scaling in regex and input size.
AI-written summary · about
chapters (12)
- 0:00Regex matching complexity
- 1:29Linear regex engines rarity
- 3:14JavaScript regex semantics
- 4:40Priority rules in regex
- 6:23Star semantics and loops
- 8:55Fixing NFA simulation
- 10:21Lookarounds with capture groups
- 12:25Precomputing lookaround positions
- 13:50Capture reset and linear matching
- 15:17Experimental validation
- 15:58Lessons from JavaScript regex
- 17:06Question and answer session
related talks
29mReimplement RegExp in JavaScript
25mFormal Verification for JavaScript Regular Expressions: A Proven Mechanized Semantics(…)
01h 06mEverybody stands back! I know regular expressions
24mSolving String Constraints with Regex-Dependent Functions through Transducers wi
17mWhen Chomsky Met JavaScript: Exploring the Linguistics(...)
01h 13m/ Reg (exp) {2} lained / Demystifying Regular Expressions
22mTwo Problems: Regular Expressions for Revolutionaries
26mTotal ReDoS: The Dangers of regex in JavaScript
