Regex Tester Online

Test regular expressions live with match highlighting, group captures, and replace mode. Free regex checker — no signup required.

/ /
Match Highlighting 0 matches
Matches & Groups

Enter a pattern and test string above.

Example Patterns

What Is a Regular Expression?

A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex engines are built into virtually every programming language — JavaScript, Python, Java, Go, Rust, PHP — and are used for input validation, text extraction, search-and-replace, parsing log files, and much more.

This online regex tester evaluates your pattern in real time using the JavaScript regex engine, highlights every match in your test string, and shows captured groups for each match.

Regex Quick Reference

Character Classes

.Any character (except newline)
\dDigit [0–9]
\DNon-digit
\wWord character [a-zA-Z0-9_]
\WNon-word character
\sWhitespace (space, tab, newline)
\SNon-whitespace
[abc]Character set — a, b, or c
[^abc]Negated set — not a, b, or c
[a-z]Range a through z

Quantifiers

*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times
*?Lazy 0 or more
+?Lazy 1 or more

Anchors & Groups

^Start of string / line
$End of string / line
\bWord boundary
(abc)Capturing group
(?:abc)Non-capturing group
a|bAlternation — a or b
(?=abc)Positive lookahead
(?!abc)Negative lookahead

Common Regex Patterns

Email Address
[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}
URL
https?:\/\/[^\s/$.?#].[^\s]*
IPv4 Address
\b(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}\b
Date (YYYY-MM-DD)
\b\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])\b
US Phone Number
(?:\+1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}

Frequently Asked Questions

What regex flags are available?

g (global) finds all matches instead of stopping at the first. i makes matching case-insensitive. m makes ^ and $ match at line boundaries. s (dot-all) makes . also match newline characters.

How do capturing groups work?

Wrap any part of your pattern in parentheses () to create a capturing group. For each match, the tester shows the full match plus every captured group numbered from left to right. In replace mode you can reference groups with $1, $2, etc.

Which programming languages does this regex syntax apply to?

This tester uses the JavaScript (ECMA-262) regex engine. The syntax is very similar to Python, Java, Go, Ruby, and PHP, though some advanced features like named captures or atomic groups have slightly different syntax across engines. Always verify critical patterns in your target language.

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (*, +, {n,m}) match as much text as possible. Lazy variants (*?, +?) match as little as possible. For example, <.+> matches the entire string <b>text</b>, while <.+?> matches just <b>.

How do I escape special regex characters?

Prepend a backslash \ before any of these special characters to match them literally: . * + ? ^ $ { } [ ] | ( ) \. For example, to match a literal period use \..