Regex Tester
Everything is processed locally in your browser; nothing is uploaded
How to Use
📖 Tool Introduction
The regular expression tester turns the most trial-and-error part of writing patterns into something you can see as you go. Put a pattern and some test text on the left and the right side immediately shows match highlighting, full detail for every match, and an optional replacement preview. There is no editor to open, no script to write, no run-and-check cycle. It is built for the situations that actually come up: pulling order numbers out of a log line, confirming the boundary of a form validation rule, rewriting timestamps across a batch of records.
The interface splits into three areas. The pattern field sits at the top wrapped in slashes, mirroring the /pattern/flags form you write in code. Below it is the test text area, which accepts content of any length. The right column holds the flag switches: the six common flags appear as checkboxes you can click, so there is no need to memorise what each letter means.
Results come in two views. The highlight pane marks matched fragments in blue and leaves unmatched text untouched, so you can see at a glance where the pattern reaches and whether it over-matches or under-matches. The match detail lists every hit with its index, start position and matched text. Patterns with groups expand $1, $2 and so on in order, and named groups are listed separately, which saves counting parentheses by hand.
The replacement field is optional. Fill it in and the pane below shows the fully replaced text live, supporting backreferences such as $1 so you can validate a bulk rewrite before running it anywhere. Leave it empty and the tool only analyses matches without substituting.
Everything runs in the browser. The pattern is executed by the native JavaScript engine and the test text never leaves your device, which matters when what you paste is production logs, API payloads or samples containing user data. The tool reports match count, largest group count and elapsed time; that timing figure helps you spot catastrophic backtracking, because a poorly written pattern over a large input can stall the whole page.
✨ Key Features
- Live highlighting: matched fragments are marked in place while unmatched text stays as it was, so coverage and gaps are obvious
- Six flag switches: g, i, m, s, u and y appear as check boxes you can click, with no need to memorise letters
- Match detail: every hit lists its index, start position and matched text in order of appearance
- Group expansion: numbered groups show as $1 and $2, named groups are listed by name, no counting parens by hand
- Replacement preview: type a replacement and see the result instantly, with $1 style backreferences for validating bulk edits
- Performance readout: match count, largest group count and elapsed time, where odd timings hint at backtracking trouble
🚀 How to Use
- Write your pattern in the field at the top; the slashes on either side are a visual hint and are not part of the input
- Paste the content you want to test into the text area below, of any length
- Tick the flags you need in the right column; global matching is on by default
- Press start: matches are highlighted above and listed one by one below
- To check a bulk rewrite, fill in the replacement text using $1 for groups, then press start again
⚠️ Things to Note
- Syntax errors are reported clearly: A malformed pattern surfaces the engine message directly instead of failing silently
- Empty matches are skipped: Patterns that can match an empty string risk looping forever, so zero length hits are guarded
- Results are capped: At most twenty thousand matches are expanded; beyond that the list stops to keep the page responsive
- Replacement never edits your text: The preview only shows the outcome and leaves what you pasted untouched
- Be careful with very long text: Several megabytes combined with a complex pattern can stall noticeably; sample first