The Regex Tester lets you write and test regular expressions against any text with instant visual feedback. See matches highlighted in real time, view capture groups, match indices, and toggle flags (global, case-insensitive, multiline, dotall) with one click. Whether you're validating email formats, parsing log files, extracting data from text, or learning regex syntax, this tool provides immediate feedback without running code. All processing happens locally using JavaScript's native RegExp engine - nour test data stays in your browser.
Type your regex pattern in the pattern field. The pattern is shown between forward slashes (/pattern/flags) for clarity. You don't need to include the slashes - just the pattern itself.
Toggle the regex flags using the buttons: 'g' for global (find all matches), 'i' for case-insensitive, 'm' for multiline (^ and $ match line boundaries), and 's' for dotall (. matches newlines).
Type or paste the text you want to test your regex against in the test string area. Matches will be highlighted instantly as you type.
All matches are highlighted in the preview. The match details table shows each match's value, position index, and any capture group contents. Use this to verify your regex works as expected.
This tool uses JavaScript's built-in RegExp engine, which supports standard regex syntax including character classes, quantifiers, anchors, groups, lookaheads, lookbehinds, and named capture groups. It supports all ES2022+ features available in modern browsers.
Flags modify regex behavior: 'g' (global) finds all matches instead of just the first; 'i' makes matching case-insensitive; 'm' (multiline) makes ^ and $ match start/end of lines; 's' (dotall) makes . match newline characters. Most patterns need 'g' to find all matches.
Capture groups are defined by parentheses () in your regex. They capture the matched text within them for extraction. For example, (\d{4})-(\d{2})-(\d{2}) on '2024-01-15' captures three groups: '2024', '01', '15'. The Groups column in the match table shows captured values.
Yes, this tool uses the exact same RegExp engine as your browser's JavaScript runtime. The results you see here will match what you get with new RegExp() or regex literals in JavaScript. Note that regex behavior may differ in other languages (Python, PHP, Java) due to engine differences.
By default, . doesn't match newline characters and ^ / $ only match the start/end of the entire string. Enable the 'm' flag to make ^ and $ match line boundaries, and enable the 's' flag to make . match newlines. This lets you write patterns that span multiple lines.