⬡ DEVELOPER

Regex Tester

Live match highlighting, flags, capture groups, and replace mode.

/
/gi
2 matches
Contact us at support@example.com or sales@company.org for help.

Common Regex Patterns

Copy and paste any of these patterns into the tester above.

Pattern NameRegexFlags
Email address\b[\w.+-]+@[\w-]+\.[\w.]+\bgi
URLhttps?:\/\/[^\s]+gi
Phone (US)\+?1?[-.\s]?\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}g
IPv4 address\b(?:\d{1,3}\.){3}\d{1,3}\bg
Date (YYYY-MM-DD)\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\bg
Hex colour#(?:[0-9a-fA-F]{3}){1,2}\bg
HTML tag<[^>]+>gi
Whitespace only lines^\s*$gm

Frequently Asked Questions

What is a regular expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. Used in programming and text processing, regex can match specific strings, validate formats (email, phone), extract data, and perform complex find-and-replace operations in a single line.

What do the flags mean?

g (global) finds all matches instead of stopping at the first. i (case-insensitive) matches regardless of case. m (multiline) makes ^ and $ match line boundaries. s (dotall) makes . match newline characters too. You can combine flags.

What is a capture group?

A capture group is a part of the pattern wrapped in parentheses (). When the regex matches, each group captures the text it matched. For example, in (\d{4})-(\d{2})-(\d{2}), three groups would capture the year, month, and day separately from a date string.

How do I use the replace mode?

Switch to 'Replace' mode, write your pattern in the regex box, type the replacement string below the test area, and see the result instantly. You can reference capture groups in the replacement using $1, $2, etc.

Why is my regex matching too much?

You may need quantifier constraints. .* matches any characters greedily. Use .*? for non-greedy matching, or be more specific with your character classes. For example, to match a word, use \w+ rather than .+.

How do I match a literal dot or bracket?

Escape them with a backslash: \. matches a literal dot, \( and \) match literal parentheses. The tool's pattern input treats \. as a literal dot just as JavaScript's RegExp constructor does.

More developer tools

JSON formatter, JWT decoder, Base64 encoder, cron builder and more.

Browse all tools