Regex Tester
Test regular expressions against sample text with live match highlighting.
Last updated August 27, 2026
2 matches
- Match 1: hello@utils.shindex 14–28
- Match 2: support@example.comindex 32–51
Quick reference
Character classes
| . | Any character except line breaks |
| \d / \D | Digit / non-digit |
| \w / \W | Word character (letter, digit, _) / non-word |
| \s / \S | Whitespace / non-whitespace |
| [abc] | Any of a, b, or c |
| [^abc] | Any character except a, b, or c |
| [a-z] | Any character in the range a to z |
Anchors & boundaries
| ^ | Start of string (or line, with the m flag) |
| $ | End of string (or line, with the m flag) |
| \b / \B | Word boundary / non-word-boundary |
Quantifiers
| a* | 0 or more of a |
| a+ | 1 or more of a |
| a? | 0 or 1 of a |
| a{2,4} | Between 2 and 4 of a |
| a+? | 1 or more of a, non-greedy (as few as possible) |
Groups & lookarounds
| (abc) | Capturing group |
| (?<name>abc) | Named capturing group |
| (?:abc) | Non-capturing group |
| a(?=b) | Lookahead — a, only if followed by b |
| a(?!b) | Negative lookahead — a, only if not followed by b |
| (?<=b)a | Lookbehind — a, only if preceded by b |
About this tool
Regular expressions are notoriously hard to get right on the first try — a single misplaced character can change what a pattern matches entirely. This tool lets you test a JavaScript-flavored regex pattern against sample text in real time: toggle flags individually, see every match highlighted inline with its exact character offsets and capture groups, preview a find-and-replace substitution before you use it in code, and check the built-in quick reference if you forget a token's syntax.
Common regex flags
| Flag | Name | Effect |
|---|---|---|
| g | Global | Find all matches, not just the first |
| i | Ignore case | Case-insensitive matching |
| m | Multiline | ^ and $ match start/end of each line |
| s | Dotall | `.` also matches newline characters |
| u | Unicode | Enables full Unicode pattern support |
| y | Sticky | Matches only from the exact current position |
Code examples
The second line (where shown) is the inverse operation.
| Language | Code |
|---|---|
| JavaScript | text.match(/pattern/g) |
| Python | re.findall(r'pattern', text) |
| PHP | preg_match_all('/pattern/', $text, $matches) |
Frequently asked questions
Which regex dialect does this use?
JavaScript's native RegExp engine, so syntax and flags match what you'd use in browser or Node.js code. Other languages (Python, PCRE, .NET) have mostly compatible but not identical syntax for some advanced features.
Why do I only see one match even though my pattern appears multiple times in the text?
Toggle on the `g` (global) flag. Without it, this tool mirrors real JavaScript behavior and only reports the first match — exactly what you'd get from `.exec()` or `.match()` without the global flag in actual code, so what you see here matches what your code will actually do.
How do I preview a find-and-replace before using it in code?
Check "Substitution" below the match list, then enter a replacement pattern using `$1`, `$2`, or `$<name>` to reference capture groups (or `$&` for the whole match). It runs your text through the same `String.replace()` logic JavaScript uses, so the preview is exactly what you'd get in real code.
More in Data & Code
Format, minify, and validate JSON with clear error messages.
Convert CSV data to JSON, with or without a header row.
Convert JSON arrays, objects, and API responses into spreadsheet-ready CSV. Flatten nested fields, choose how arrays are handled, preview the columns, and download the result — all in your browser.