Regex Tester & Debugger
Test regex patterns with real-time highlighting
Test and debug regular expressions online with real-time match highlighting, capture group inspection and full flag support (g, i, m, s, u). Instant feedback — no server round-trip. The fastest regex tester for developers.
No matches
// quick guide
A regular expression (regex) is a compact language for describing text patterns. Once you understand the syntax, a single regex can do the work of dozens of lines of string manipulation code — matching email addresses, extracting values from logs, validating input formats, or reformatting structured text.
This tester gives you real-time feedback as you write: matches are highlighted in the test string as you type, capture groups are shown individually, and the replace tab lets you preview substitutions before applying them in your code.
How to use this tool:
- Enter your pattern in the Regex Pattern field. The tool accepts standard JavaScript/PCRE-compatible syntax.
- Add flags after the pattern field:
g(global — find all matches),i(case-insensitive),m(multiline —^and$match line boundaries),s(dot matches newlines),u(Unicode mode). - Type or paste your test string in the Test Text area. Every match is highlighted in real time. Hover over a match to see its capture groups.
- Switch to the Replace tab to preview substitutions. Use
$1,$2to reference numbered capture groups, or named groups with$<name>.
Quick reference for common patterns:
- Email:
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} - IPv4 address:
\b(?:\d{1,3}\.){3}\d{1,3}\b - Date (YYYY-MM-DD):
\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]) - HTTP URL:
https?://[^\s/$.?#][^\s]*
All pattern matching runs locally in JavaScript — no text or patterns are sent to any server.
// frequently asked questions
What is regex used for?
Regex is used to validate input formats (like emails, phone numbers, or dates), search for specific strings inside large files, extract text using capture groups, and automate text replacements.
What do regex flags like g, i, and m mean?
Flags modify how regex matches patterns. 'g' (global) finds all matches instead of stopping at the first one; 'i' makes matching case-insensitive; and 'm' (multiline) treats start/end anchors (^ and $) as matching the start/end of each line rather than the whole string.
Is it safe to test secret tokens or logs here?
Yes. All regex testing and replacements are computed locally inside your browser using Javascript. No text or patterns are sent over the network.
What is the difference between a capturing group () and a non-capturing group (?:)?
A capturing group () stores the matched text so you can reference it later via $1, $2, etc. in replacements, or inspect it as a capture group. A non-capturing group (?:) groups subpatterns for quantifiers or alternation without creating a back-reference. Use non-capturing groups when you only need grouping for structure, not for extraction.
How do I match a literal dot, parenthesis, or other regex metacharacter?
Precede the character with a backslash to escape it: \. matches a literal dot, \( matches a literal opening parenthesis, \+ matches a literal plus sign, and so on. Without the backslash, these characters have special meanings in regex syntax.