Regex Tester
Test JavaScript regular expression patterns against test strings. Displays live match counts, match indices, and named capture groups.
3 matches highlighted
| # | Match | Position | Groups |
|---|---|---|---|
| 1 | team@swizztool.com | 27 | $1: team $2: swizztool.com |
| 2 | accounts@swizztool.io | 106 | $1: accounts $2: swizztool.io |
| 3 | support@example.org | 131 | $1: support $2: example.org |
How to use Regex Tester
- Enter your regular expression pattern in the Pattern field.
- Toggle flags such as Global (g), Case-Insensitive (i), or Multiline (m).
- Type or paste test text into the test string editor.
- Review match counts and capture groups.
About Regex Tester
Test a regular expression against your own text and see every match highlighted as you type. A table lists each match with its position and capture groups, and you can toggle the global, ignore-case, multiline, and dot-all flags.
Related tools: JSON Formatter & Validator, Base64 Encoder / Decoder, URL Encoder / Decoder, JWT Decoder
Reading the results
Matches are highlighted in the text so you can see at a glance what the pattern catches and what it misses. The table below shows each match, its character position, and the value of each capture group, either numbered ($1, $2) or named.
If the pattern is invalid, the error appears under the pattern field and the previous results are cleared, so you never debug against a stale match.
Flags
All matches (g) finds every match; without it, only the first is returned. Ignore case (i) treats uppercase and lowercase as equal. Multiline (m) makes ^ and $ match at each line instead of only the whole text. Dot matches newline (s) lets . match line breaks.
The tester uses your browser's JavaScript engine, so results match what the same pattern does in JavaScript and TypeScript code. Other languages such as Python or PHP support most of the same syntax but differ in a few features.
Common uses
- Validating input
- Check an email, phone, or postcode pattern against real examples before shipping it.
- Extracting data
- Pull IDs, dates, or URLs out of logs and copy the matches.
- Search and replace prep
- Get a pattern right here before using it in Find and Replace or your editor.
- Learning regex
- Experiment with groups and flags and see the effect immediately.
Questions about Regex Tester
- What regular expression engine is used?
- The tester runs directly on the native V8/JavaScript RegExp engine in your browser.
- How do I copy just the matches?
- Click Copy or Download in the toolbar. Both export the matched text, one match per line.
- Why does my pattern match nothing with ^ and $?
- Without the Multiline flag, ^ and $ match only the start and end of the whole text. Turn on Multiline to match each line.
- Does it support lookbehind and named groups?
- Yes. It uses your browser's JavaScript engine, which supports lookahead, lookbehind, named groups, and Unicode property escapes in modern browsers.
- Is my test text uploaded?
- No. Matching runs in your browser.
Comments
Questions, ideas, or a bug in Regex Tester? Let us know.