Regex Tester

Write and test regular expressions with real-time matching, highlighting, and capture group extraction.

/ /

Common Regex Patterns

Email
[\w.+-]+@[\w-]+\.[\w.]+
URL
https?://...
IP Address
\b\d{1,3}\.\d{1,3}...
Date (DD/MM/YYYY)
\d{2}[/-]\d{2}[/-]\d{4}
Phone Number
[+]?\d{1,3}[\s-]?\d{4,14}
HEX Color
#([0-9a-fA-F]{6}|{3})

What Is a Regex Tester?

A regex tester lets you write a regular expression pattern and instantly see which parts of your test string match. Matches are highlighted in the text, capture groups are extracted and displayed in a table, and errors in your pattern are reported in real time. This tool uses JavaScript's regex engine, making it ideal for testing patterns you'll use in JavaScript, TypeScript, or Node.js projects.

Common Regex Syntax

\d matches any digit (0-9). \w matches any word character (letters, digits, underscore). \s matches whitespace. . matches any character except newline. + means one or more. * means zero or more. ? means optional. {n,m} matches between n and m times. ^ matches the start and $ matches the end. Parentheses () create capture groups. Square brackets [] define character classes.

Regex Flags Explained

Flags change how the regex engine processes your pattern. The g (global) flag finds all matches instead of stopping at the first one. The i flag makes matching case-insensitive. The m (multiline) flag makes ^ and $ match the start and end of each line, not just the entire string. The s (dotAll) flag makes the dot . match newline characters too.

Frequently Asked Questions

A regex is a pattern that describes a set of strings. It's used for searching, matching, validating, and extracting text in programming. For example, \d{3}-\d{4} matches phone numbers like 123-4567.
'g' finds all matches. 'i' ignores case. 'm' makes ^ and $ match line boundaries. 's' makes dot match newlines.
Parts of a pattern in parentheses () that capture matched text for later reference. In (\d{2})-(\d{2})-(\d{4}), each group captures a date component separately.