Regex Tester
Type a regex pattern, pick the flags, and see matches highlighted in your test string live, capture groups included. Everything runs in your browser.
How to Test a Regular Expression
A regex (regular expression) is a pattern language used to describe and match sequences of characters in text. It is widely used for email validation, form checks, log parsing and search-and-replace. This tool runs the pattern you type through JavaScript's RegExp engine instantly: it highlights matches inside your test string, shows the total match count, and lists the capture groups for every match. No data is sent to a server, all computation happens in your browser.
Regex Flags
| Flag | Meaning |
|---|---|
| g | Global: finds all matches instead of stopping at the first one. |
| i | Case-insensitive: ignores upper/lower case differences. |
| m | Multiline: makes ^ and $ match the start/end of every line. |
| s | Dotall: makes . match newlines (\n) too. |
| u | Unicode: treats the pattern and string as Unicode code points. |
| y | Sticky: matches only from a specific position (lastIndex). |
Frequently Asked Questions
What do the g, i, m, s, u, y flags mean?
g (global) finds all matches instead of stopping at the first one. i (case-insensitive) ignores upper/lower case differences. m (multiline) makes ^ and $ match the start/end of every line. s (dotall) makes the dot match newlines too. u treats the pattern and string as Unicode code points. y (sticky) matches only from a specific position.
How do capture groups work?
Parts of a pattern wrapped in parentheses () form a capture group and store the matched substring separately. Groups are numbered left to right (1, 2, 3...). Named groups can be defined with (?<name>...); this tool lists both numbered and named groups for every match.
What are some common regex patterns?
Common examples include [\w.+-]+@[\w-]+\.[a-zA-Z]{2,} for validating emails, \d+ for capturing digits only, and https?://[^\s]+ for finding URLs in text. Click the example buttons above to try them instantly.