JavaScript Regex Tester and Replace Preview
Test JavaScript regex flags, capture groups, match ranges, and replacement output against sample text.
Match summary
2 / /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/gd
Groups
20260630Replacement preview
Replacement preview
How to use
Run a JavaScript regular expression against editable text, inspect every displayed match and capture group, then preview replacement output before using it in code.
- 1Enter a JavaScript regex pattern or load a date, email, URL, or word sample.
- 2Choose the flags that control global matching, case, lines, Unicode, stickiness, or indices.
- 3Paste test text and inspect match ranges, zero-length matches, and numbered or named groups.
- 4Enter a replacement, compare the preview, then copy the regex, match summary, or replacement output.
Technical background
The engine uses the browser JavaScript RegExp implementation with flags d, g, i, m, s, u, and y. Patterns are limited to 500 characters, test text to 20,000 characters, and the match list to the first 200 results.
Use cases
Debug validation patterns, extract dates or identifiers, check capture groups, compare global and multiline behaviour, and test replacement strings.
Privacy and security
Patterns, test text, and replacement values stay in the browser. Remove secrets, private logs, and production credentials before copying or sharing results.