Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

JavaScript Regex Cookbook: matchAll, Named Groups, the /g lastIndex Bug, replaceAll, Unicode Flag and ReDoS

Self-Hosting & Infra intermediate 6 min read $0.01 Updated 2026-10-20

Executed on Node 22: named groups from matchAll, match with and without g, lastIndex alternating true and false, replaceAll TypeError for non-global regex, lookahead and lookbehind, dotAll, unicode flag counts, sticky matching and a ReDoS timing.

Use JavaScript regular expressions without surprises: matchAll with named groups, the stateful /g test() bug, replace versus replaceAll, $ and newlines, the u flag for emoji and \p{L}, and catastrophic backtracking.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →