Regex Tester
Write your regex pattern, paste test text, and see matches highlighted instantly. Supports flags, capture groups, and replace mode.
How to use Regex Tester
The Regex Tester lets you write, test and debug regular expressions interactively against live sample text. It highlights all matches in real time, displays captured groups in a structured table and supports common regex flags such as global, case-insensitive, multiline and dotAll — making it an essential tool for validating patterns before embedding them in code.
- Enter your regular expression in the pattern field (without surrounding slashes).
- Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotAll).
- Type or paste your test string in the input area.
- Matches are highlighted inline and listed in the matches panel below.
- Expand any match row to inspect individual capture groups and their positions.
- Copy the working regex (with flags) to use directly in your code.
Your data never leaves your device — 100% private processing.
Understanding regex flags
Flags modify how the regex engine processes the pattern. The global flag (g) finds all matches rather than stopping at the first. The case-insensitive flag (i) makes letter comparisons ignore case. The multiline flag (m) makes ^ and $ match the start and end of each line instead of the entire string. The dotAll flag (s) makes the dot metacharacter match newline characters, which it normally excludes. Combining flags gives fine-grained control over matching behaviour.
Capture groups and named captures
Parentheses create capturing groups that extract sub-matches. For example, (d{4})-(d{2})-(d{2}) captures year, month and day from an ISO date string into groups 1, 2 and 3. Named captures (?<year>d{4}) assign a label, making patterns self-documenting. Non-capturing groups (?:...) group tokens without creating a capture, which improves performance and keeps group numbering clean.
| Token | Meaning | Example |
|---|---|---|
| . | Any character except newline | a.c → "abc", "a1c" |
| \d | Digit [0-9] | \d{3} → "123" |
| \w | Word character [A-Za-z0-9_] | \w+ → "hello_1" |
| ^ | Start of string/line | ^Hello → "Hello world" |
| $ | End of string/line | world$ → "Hello world" |
| * | Zero or more | ab* → "a", "ab", "abb" |
| + | One or more | ab+ → "ab", "abb" |
| ? | Zero or one (optional) | colou?r → "color", "colour" |
Glossary
- Regex
- Regular expression — a pattern that describes a set of strings using special syntax.
- Lookahead
- A zero-width assertion (?=...) that matches a position followed by a specific pattern without consuming characters.
- Lookbehind
- A zero-width assertion (?<=...) that matches a position preceded by a specific pattern.
- Quantifier
- A token such as *, +, ?, {n,m} that specifies how many times the preceding element may appear.
- Backreference
- A token \1 that matches the same text previously matched by capture group 1.
Related reading
Frequently Asked Questions
Get weekly tool tips & updates
New tools, power-user tips, and productivity hacks — delivered free every Friday.
No spam, ever. Unsubscribe with one click.
Why use Regex Tester?
- No installation — use directly from any browser
- Handles large inputs without crashing or timeouts
- Syntax highlighting and formatted output for readability
- Copy to clipboard shortcut for fast workflow integration
Common use cases
- Validate and format JSON responses from APIs
- Encode/decode Base64 strings during debugging
- Generate UUIDs for database seeds or test data
- Minify CSS or JavaScript before deployment
- Diff two code snippets to spot regressions
Related Developer Tools
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Includes syntax highlighting, error detection, and a collapsible tree view — free, private, in-browser.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to text. Fast, free, and runs entirely in your browser.
URL Encoder / Decoder
Encode and decode URLs and URL components online. Convert special characters to percent-encoding and back instantly — free, private, and fast.
HTML Encoder / Decoder
Encode and decode HTML entities online. Escape <, >, &, and quote characters for safe HTML display. Free, instant, and private — runs in your browser.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes online. Hash text or files privately in your browser.
Hash Generator
Generate cryptographic hashes online. Support for SHA-1, SHA-256, SHA-384, and SHA-512. Instant, secure, client-side.
Explore all Developer Tools.