Regex Tester — Live Regular Expression Testing

Write and test regular expressions live. Matches are highlighted as you type. Supports all standard JavaScript regex flags — global, case-insensitive, multiline, dotall.

//g

Quick Regex Reference Guide

The most commonly used regex patterns and what they match:

PatternMatches
\dAny digit (0–9)
\wAny word character (a–z, A–Z, 0–9, _)
\sAny whitespace (space, tab, newline)
.Any character except newline
^Start of string (or line with m flag)
$End of string (or line with m flag)
[abc]Any of a, b, or c
[^abc]Any character except a, b, c
a{3}Exactly 3 consecutive a's
a{2,5}2 to 5 consecutive a's
(foo|bar)Either 'foo' or 'bar'
(?=...)Positive lookahead

Common Regex Patterns for Developers

Email Validation

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Indian Phone Number

^[6-9]\d{9}$

URL Matching

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,6}\b

IP Address (IPv4)

^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$

Date (YYYY-MM-DD)

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$

Frequently Asked Questions

What regex flavor does this tester use?

This tester uses JavaScript (ECMAScript) regular expressions, which covers the vast majority of use cases. JavaScript regex is supported in all major browsers and is compatible with regex patterns used in TypeScript, Node.js, and many other languages.

What do the regex flags g, i, m, s mean?

g (global) finds all matches, not just the first. i (case-insensitive) treats uppercase and lowercase as equal. m (multiline) makes ^ and $ match start/end of each line, not just the whole string. s (dotall) makes the dot . match newlines as well.

How do I match an email address with regex?

A common email regex pattern is: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. Note that a truly comprehensive email regex is complex — for production use, consider validating email format with a dedicated library after basic regex pre-filtering.

What is the difference between .* and .+?

. matches any character except newline. * means zero or more of the preceding element. + means one or more. So .* matches an empty string or any characters, while .+ requires at least one character.

How do capture groups work?

Parentheses () create capture groups that extract specific parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) applied to '2026-04-29' captures three groups: year '2026', month '04', day '29'. Named capture groups use (?<name>...).

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (* +) match as much as possible. Lazy quantifiers (*? +?) match as little as possible. For example, on '<b>text</b>', <.+> (greedy) matches the entire string, while <.+?> (lazy) matches only '<b>'.

Related Tools