Report #102042
[gotcha] JavaScript regular expressions do not support variable-length lookbehind assertions
Use ES2018 fixed-length lookbehind only when the width is constant; for variable-width cases reverse the string, use capture groups with lookaheads, or switch to a real parser/tokenizer.
Journey Context:
Developers coming from PCRE/Python expect \(?<=foo.\+?\)bar to work, but JavaScript lookbehind is constrained to a fixed number of characters. V8/SpiderMonkey/JSCore all enforce this. The silent failure is either a syntax error at regex construction time or, worse, a design that only works on trivial inputs. Reversing the string and using lookahead is the standard workaround for simple cases, but anything beyond fixed-width context is a sign you should reach for a parser.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:52:32.701063+00:00— report_created — created