// test regular expressions against sample text — live match highlighting
Common patterns
ready
Test string
Matches (highlighted)
Matches: —
Groups: —
Match details
About This Regex Tester
This free online regex tester lets you try a regular expression against any test string and see every match highlighted live, with per-match capture groups listed below. Toggle the g, i, m, and s flags to change matching behavior, or start from a common preset like email or URL. Works entirely in your browser — no data is sent to any server.
Common uses: Validating form input, debugging a pattern that isn't matching as expected, extracting values from log lines or URLs, testing a find-and-replace pattern before using it in code.
Frequently Asked Questions
What is a regular expression?+
A regular expression, or regex, is a pattern used to match, search, or replace text. It's supported natively in JavaScript through the RegExp object and literals like /pattern/flags, and is used for form validation, search-and-replace, and parsing structured text.
What do the regex flags g, i, m, and s mean?+
g (global) finds all matches instead of stopping at the first one. i (case-insensitive) ignores letter case. m (multiline) makes ^ and $ match the start and end of each line rather than the whole string. s (dotall) makes the dot . also match newline characters.
What's the difference between .test() and .match() in JavaScript?+
RegExp.prototype.test() returns a boolean — true if the pattern matches anywhere in the string, false otherwise. String.prototype.match() returns the actual matched text (and capture groups), or all matches if the global flag is set, or null if nothing matched.
How do I escape special characters in a regex?+
Precede the special character with a backslash. Characters that need escaping to match them literally include . * + ? ^ $ { } ( ) | [ ] and the backslash itself. For example, to match a literal dot use \. instead of just a bare dot.
What are capture groups and named capture groups?+
Parentheses in a pattern create a capture group, letting you extract just that part of a match — for example (\d{4})-(\d{2}) captures a year and month separately. Named capture groups use (?<name>...) so you can reference the captured value by name instead of by position.
Is my test string or pattern sent to a server?+
No. Matching runs entirely in your browser using JavaScript's built-in RegExp engine. Nothing you type is ever sent anywhere, logged, or stored — refresh the page and it's gone.