Goodbye Regex. Hello Parsers!
summary
Regex breaks when routes and nested grammars need clarity so the demo replaces a tangled single regex with explicit TypeScript parsers, first built a parser from scratch to evaluate "12+34" with map many and satisfy primitives, then uses the library Parsimmon to implement URL routing, a GUID parser and a recursive angle grammar that parses nested key value structures. Tests run with TDD, negatives stay failing as intended, positives pass, and tradeoffs include performance vs readability and regex DoS.
AI-written summary · about
chapters (7)
- 0:00Start
- 0:09Hello Parsers! Hackle Wayne
- 1:09Less RegEx. More Parsers! A user's view
- 7:35Parsers can help! How, what and why
- 9:20Case study A rest-some URL
- 32:45Live coding... A naive parser from scratch
- 57:44RegEx = Parsers @hacklew
related talks
26mParsing Parsers
01h 13m/ Reg (exp) {2} lained / Demystifying Regular Expressions
22mTwo Problems: Regular Expressions for Revolutionaries
43mTotal ReDoS: the dangers of regex in JavaScript
05mRegular expressions my secret love
29mReimplement RegExp in JavaScript
24mSolving String Constraints with Regex-Dependent Functions through Transducers wi
58mFun With Parsing
