Regex Tester
Test JavaScript regular expressions live: match highlighting, capture group table, named groups and replace preview — with a catastrophic-backtracking guard.
JavaScript (ECMAScript) flavour. Your pattern and test string stay after the # and are never sent.
Your pattern and test string live after the # in the address bar. Browsers never send the fragment in an HTTP request, so it cannot reach our logs, a CDN’s or a proxy’s.
Result
Type a pattern to see matches.
Cheat sheet
.Any character except a newline\dA digit (0–9)\wA letter, digit or underscore\sAny whitespace[abc]Any one of a, b or c[^abc]Any character except a, b or c[a-z]Any character in the range*Zero or more of the previous item+One or more of the previous item?Optional — zero or one{2,4}Between 2 and 4 of the previous item*?Lazy — match as few as possible(…)Capture group(?:…)Group without capturing(?<n>…)Named capture groupa|bEither a or b^Start of the string (or line with m)$End of the string (or line with m)\bWord boundary(?=…)Lookahead — followed by(?!…)Negative lookahead — not followed by(?<=…)Lookbehind — preceded by\1Back-reference to group 1\p{L}Unicode property (needs the u flag)How to use
- Type your pattern between the / / marks, or click a starter such as Email, IPv4 or Semver.
- Toggle the flag buttons g, i, m, s, u, y and d — each one names what the flag does.
- Paste your text into ‘Test string’ — matches are highlighted and listed with their groups.
- Switch to the Replace tab and write a replacement using $1 or $<name> to preview the output.
- Use ‘Copy pattern’, ‘Copy matches (JSON)’ or ‘Share link’ to take the result with you.
FAQ
Why only the JavaScript flavor?
Because JavaScript is the only flavor a browser can run. PCRE, Python and .NET flavors require a server, which means your pattern and your test data — often production log samples — get transmitted. We would rather be honest about the limit than send your data away.
Is my test string in the share link sent anywhere?
No. We put it after the #, and browsers never send the fragment in an HTTP request. It cannot appear in our access logs, a CDN’s, or a proxy’s. Query-string sharing, which other tools use, does end up in logs.
What is catastrophic backtracking?
Some patterns — typically nested quantifiers like (a+)+$ — make the engine try exponentially many combinations, freezing the tab. We run every match in a Web Worker with a 2-second watchdog and stop it instead of letting your browser hang.
Related tools
More Developer tools: Developer