Regex Tester
TextTest JavaScript regular expressions with flags like g, i, m, s and u plus capture groups, listing every match and named group as you type. All hits listed.
Contact alice@example.com or bob@test.org for details, or admin@site.io
alice@example.com@ 8–25aliceexample.combob@test.org@ 29–41bobtest.orgadmin@site.io@ 58–71adminsite.ioRelated Tools
About Regex Tester
A regular expression (regex) is a language for matching string patterns, supported by virtually every programming language. This tool uses the browser's native RegExp engine to provide live pattern matching with real-time syntax highlighting of matches in the input text. It supports all standard regex flags (g, i, m, s, u, y), named and numbered capture groups, lookahead/lookbehind assertions, and alternation. The match results panel displays each match with its capture groups, group names, and positional indices, making it invaluable for debugging complex patterns before you deploy them in code. For instance, test strings against ^[a-z0-9]+$ with instant highlight, capture groups and a replace preview — no tool switching needed.
How to Use
- Open the Regex Tester tool
- Enter your regular expression in the pattern field
- Enter test text in the test text area
- View highlighted matches and the match list
- Use Replace mode for text substitution
Use Cases
- Form validation — Debug email, phone, URL, and password-strength validation patterns.
- Log extraction — Pull timestamps, error codes, IP addresses, and other fields out of large log files.
- Batch replacement — Iterate on a regex here, then apply it via your editor's find-and-replace across the codebase.
- Web scraping cleanup — Extract structured data — prices, titles, ratings — from scraped HTML.
- Learning regex syntax — Tweak a pattern and see live highlights — much faster than reading docs.
- Search and replace preview — Test regex substitution patterns with capture group references ($1, $2) before running them across your codebase.
- Data validation pipelines — Build and debug multi-step validation patterns for CSV rows, log entries, or user-submitted form data.
FAQ
Which regex flavor does this tool use?
JavaScript / ECMAScript flavor (a subset of PCRE). Notable gaps: no \g back-references, no atomic groups (?>), no balancing groups. Python's re module is mostly compatible.
Why doesn't my regex match?
Most common reasons: (1) missing g flag matches only the first hit; (2) unescaped special chars . * ? +; (3) using ^/$ on multiline text without the m flag.
Can regex have performance issues?
Yes. Nested quantifiers like (a+)+ on a non-matching input can trigger catastrophic backtracking and freeze a page. This tool uses the native engine, which times out and aborts.
How do I test grep or sed regex?
They use BRE/ERE flavors that escape some metacharacters differently (e.g. \(\) for groups). This tool is not fully compatible — for complex shell regex, test directly in the terminal.
How do I remember common patterns?
See our Regex Cheatsheet tool, which collects ready-made patterns for email, URL, IP, credit-card, and more.
Why doesn't ? match the character I expected?
A question mark has two meanings in regex: right after a character it means the preceding character appears 0 or 1 times (colou?r matches both color and colour), while after a quantifier * + ? it makes the match lazy (non-greedy). If you actually want a whole optional fragment, a bare ? often scopes incorrectly. Instead, wrap the fragment you want optional inside a group first, e.g. (https?://)?, and use a non-capturing group (?:...)? if you don't need to capture it. Put it outside the parentheses and test again so it only affects the whole group, not the single adjacent character.
Why doesn't . match newlines?
By default the dot . matches any character except a line terminator, so on multiline text it stops at the end of each line. Fix it three ways: add the s flag (single-line mode) so . also matches newlines; use [\s\S] to cover both whitespace and non-whitespace; or write [^\n] explicitly (which still excludes newlines). For matching an entire block across lines, prefer the s flag with a lazy .*?; paste the real multiline log into the test area first to confirm the result.