Regex Tester
Write a regular expression, paste your test string, and see matches highlighted in real time. Captured groups are shown separately.
All processing is client-side — your data never leaves your browser.Regular expression reference
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. Regex engines scan through text looking for substrings that match the pattern. They are built into nearly every programming language and power features like form validation, search-and-replace, log parsing, and data extraction.
Flags explained
g (global) finds all matches, not just the first. i (case insensitive) treats uppercase and lowercase as equal. m (multiline) makes ^ and $ match line boundaries instead of string boundaries. s (dot all) allows . to match newline characters, which it skips by default.
Common patterns
| Pattern | Matches |
|---|---|
| [\w.+-]+@[\w-]+\.[a-z]{2,} | Email addresses (simplified — not RFC 5322 complete) |
| https?://[\w/:%#$&?()~.=+\-]+ | HTTP and HTTPS URLs |
| \b\d{3}[-.\s]?\d{3}[-.\s]?\d{4}\b | US phone numbers (various formats) |
| #[0-9a-fA-F]{3,6}\b | CSS hex color codes |
| \b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b | UUID v4 (lowercase, with i flag) |
| ^\s*$ | Empty or whitespace-only lines (use m flag) |
| \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b | IPv4 addresses (rough match) |
JavaScript regex syntax
This tester runs JavaScript's built-in RegExp engine. It supports named capture groups ((?<name>...)), lookaheads, lookbehinds, and Unicode property escapes. Features from older engines like POSIX character classes or backreferences via \1 work as expected, but atomic groups are not supported.
How to use
- 1Enter your regex pattern
Type your regular expression in the pattern field. Add flags (g, i, m) as needed.
- 2Paste your test string
Enter the text you want to match against in the test input area.
- 3Read the results
Matches are highlighted in the text. The results panel shows total match count and any capture group values.
Frequently asked questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It can match exact strings, character classes ([a-z]), repetitions ({2,5}), anchors (^, $), and groups (()). They are used for validation, search-and-replace, parsing, and text extraction.
What flags are supported?
Three flags: g (global — find all matches, not just the first), i (case-insensitive — match A and a alike), and m (multiline — make ^ and $ match line boundaries, not just string start/end). Combine them freely: gi, gm, gim.
How do I use capture groups?
Wrap any part of your pattern in parentheses to create a capture group, e.g. (\d+). The tool displays the matched groups separately in the results panel so you can see exactly what each group captured.
Does it use JavaScript regex syntax?
Yes — the tool uses the standard JavaScript RegExp engine. JavaScript regex syntax is compatible with most common patterns, though some advanced features found in PCRE (like lookbehinds in older browsers) may not be available.