Regex tester
Test a pattern, inspect its groups and preview your replacement.
JavaScript syntax, without / delimiters. Use (?:) to test an empty pattern.
d indices · g all · i case-insensitive · m multiline · s dotAll · u/v Unicode · y sticky
Highlighted matches
Enter a pattern and test text, or try the example.
JavaScript tokens: $$, $&, $1…$99, $<name>, $`, $'. Empty text deletes matches.
Limits (UTF-16): text 100,000; pattern 2,000; replacement 10,000; 1,000 matches; output/captured data 1,000,000. Timeout: 800 ms.
Local processing. Your test text and patterns are not saved or added to the URL.
Matches and groups
Positions: zero-based UTF-16 units, end exclusive. Empty matches are labelled.
| Match | Start | End | Text | Capture groups |
|---|
Matches will appear here with positions and groups.
Related tools
Test a JavaScript regular expression against your own text before using it in code. Matches appear in the highlighted view and in a table with their positions and capture groups. A replacement preview helps you check rearranged dates, cleaned spacing or extracted values. Start with a short example, then add cases that should not match. Everything runs in a separate browser worker, so an expensive pattern can be stopped without locking the page.
How to use
- Enter a pattern without surrounding slashes, then choose flags such as g or i.
- Paste test text, or use the example button to try named date groups.
- Inspect the numbered matches, positions and captured values before changing the replacement.
- Enter replacement text, check the preview and copy it. Ctrl/⌘+Enter runs immediately; Ctrl/⌘+Shift+C copies.
What it handles
- JavaScript flags d, g, i, m, s, u, v and y; support depends on your browser.
- Numbered and named groups, including unmatched groups and zero-width matches.
- A small library for email-shaped text, numbers, date shapes, whitespace and Unicode words.
- Every edit cancels the previous run; Clear removes current inputs and results.
FAQ
Which regex flavor does this use?
This tool uses your browser’s native JavaScript RegExp implementation. Syntax from other regex engines may behave differently or be rejected. Use g for all matches, i to ignore case and u or v for Unicode behavior. The u and v flags cannot be combined; repeated flags are invalid.
What are the exact limits?
Text is limited to 100,000 UTF-16 units, patterns to 2,000 and replacement templates to 10,000. A run allows 1,000 matches and 800 ms including worker startup. Output is capped at 1,000,000 units. Captured data has a 1,000,000-unit budget, counting group names and separators. Exceeding a limit clears the preview; shorten the sample or simplify the pattern.
How do groups and replacement tokens work?
Replacement follows JavaScript string rules: $& inserts the match, $1 through $99 insert numbered captures, and $<name> inserts a named capture. $$ inserts a dollar sign; $` and $' insert the prefix and suffix. Unmatched captures become empty text. Without g only the first match is replaced.
Are positions characters, and is my text saved?
Start and end positions are zero-based UTF-16 offsets; the end is exclusive. Emoji can occupy two units. Unicode mode advances past a complete code point after an empty match. Inputs are neither uploaded nor saved in browser storage or the page URL. Reloading discards the current test.
Updated