Regular Expression Tester
Test and debug regular expressions with live match highlighting and group capture display.
Use $1, $2 for group captures, $& for full match.
What Is a Regular Expression Tester?
A Regular Expression (regex) tester is an interactive tool that allows you to write, test, and debug regular expressions in real time. Regular expressions are powerful pattern-matching strings used in programming, text processing, data validation, and search-and-replace operations. This tool highlights all matches in your test string, shows exact positions (indices), match lengths, and any captured groups — making it much faster to build and validate complex patterns.
How to Use This Regex Tester
1. Enter your pattern — Type your regex in the
pattern field between the / / delimiters. Use the flag toggles to
enable global (g), case-insensitive (i), multiline (m), or dot-all (s) matching.
2. Paste your test string — Enter the text you
want to test against. Matches will be highlighted live in green (and alternating gold for adjacent matches).
3. Review match details — The table below the
highlight shows each match number, the matched value, its character index, length, and any group
captures from parentheses in your pattern.
4. Use common pattern shortcuts — Click any
pattern chip (Email, URL, Date, etc.) to instantly load a ready-made pattern into the editor.
Common Use Cases
Regex testers are used by developers for form validation (emails, phone numbers, zip codes), log parsing (extracting timestamps, error codes), data scraping (pulling URLs or prices from HTML), code refactoring (bulk find-and-replace in editors), and text processing pipelines in Python, JavaScript, Java, and more.
Frequently Asked Questions
What regex engine does this tool use?
This tester uses the built-in JavaScript regex engine (ECMAScript), which supports most standard regex features including lookaheads, lookbehinds, named groups, and Unicode categories. Note that some features from PCRE (Python, PHP) like possessive quantifiers may not be supported.
How do I capture groups in my regex?
Wrap part of your pattern in parentheses to create a capturing group. For example,
(\d{4})-(\d{2})-(\d{2}) creates three groups for year, month, and day.
Captured values are shown in the Groups column of the match details table. Use
(?:...) for non-capturing groups.
Why does removing the "g" flag change results?
Without the global flag, the regex stops after finding the first match. With the global flag (g), the engine continues scanning and returns all non-overlapping matches in the string. For most testing scenarios, you'll want the global flag enabled.
What does the "s" (dot-all) flag do?
By default, the dot . metacharacter matches any character except
newlines. With the s flag (dot-all mode), the dot also matches
newline characters (\n), which is essential when matching
multi-line blocks of text.
How does Find & Replace work with groups?
In the Find & Replace tab, use $1, $2
etc. in the replacement field to insert the content of captured groups. For example, if your pattern
is (\w+)\s(\w+) and replacement is
$2 $1, it swaps first and last names.
Are my patterns and strings stored or sent anywhere?
No. All processing happens entirely in your browser using JavaScript. Your regex patterns and test strings are never sent to any server, ensuring complete privacy.
