100% FREE · NO SIGNUP

Regex Tester

Test, debug, and build regular expressions with real-time match highlighting, capture groups, and replace. Runs entirely in your browser.

Regular Expression

/ /
Matches:0
Groups:0
Steps:
Time:0ms

Common Patterns

Test String

Run a regex with capture groups to see results here.

Regex Cheat Sheet

Characters

. Any character
\\w Word [a-zA-Z0-9_]
\\d Digit [0-9]
\\s Whitespace
\\W Non-word
\\D Non-digit
\\S Non-whitespace

Quantifiers

* 0 or more
+ 1 or more
? 0 or 1
{n} Exactly n
{n,} n or more
{n,m} Between n and m
*? Lazy (non-greedy)

Anchors & Groups

^ Start of string
$ End of string
\\b Word boundary
(abc) Capture group
(?:abc) Non-capturing
(?=abc) Lookahead
(?<=abc) Lookbehind

Character Classes

[abc] a, b, or c
[^abc] Not a, b, or c
[a-z] a to z
[A-Z] A to Z
[0-9] 0 to 9
a|b a or b
\\ Escape char

🚀 More Free Dev Tools

JSON Formatter, JWT Decoder, Hash Generator, UUID Generator, and 25+ more tools.

Browse All Tools →

Free Online Regex Tester

Regular expressions (regex) are patterns used to match character combinations in strings. This tool lets you write, test, and debug regex patterns instantly with real-time match highlighting.

Why Use a Regex Tester?

JavaScript Regex Examples

// Test a pattern
const regex = /(\w+)@(\w+)\.(\w+)/g;
const text = "user@example.com";
const matches = text.matchAll(regex);

for (const match of matches) {
  console.log(match[0]); // Full match: user@example.com
  console.log(match[1]); // Group 1: user
  console.log(match[2]); // Group 2: example
  console.log(match[3]); // Group 3: com
}

// Replace with groups
const result = text.replace(regex, '$1 [at] $2 [dot] $3');
// → "user [at] example [dot] com"

Common Regex Patterns

Regex Flags Explained

Frequently Asked Questions

How do I test a regular expression online?

Paste your regex pattern into the pattern field and your test string into the text area. Matches are highlighted in real-time as you type. You can see capture groups, match positions, and all matches in the results panel. Toggle flags like global (g), case-insensitive (i), and multiline (m) as needed.

What do regex flags do?

Regex flags modify how pattern matching works. Common flags: g (global) finds all matches instead of stopping at the first; i (case-insensitive) treats uppercase and lowercase as equal; m (multiline) makes ^ and $ match line starts/ends; s (dotAll) makes . match newlines.

What is a capture group in regex?

A capture group is a portion of the regex pattern wrapped in parentheses () that captures the matched text for later use. For example, (\d{4})-(\d{2})-(\d{2}) matches a date and captures year, month, and day in separate groups. Named groups use the syntax (?<name>pattern).

How do I match an email address with regex?

A simple email regex is /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/. However, perfectly validating email addresses with regex is notoriously difficult. For production use, send a verification email rather than relying solely on regex validation, as the email spec allows many unusual formats.

What is the difference between greedy and lazy matching?

Greedy matching (default) tries to match as much text as possible. .* in <b>text</b> would match the entire string including tags. Lazy matching (.*?) matches as little as possible. In the same example, <.*?> would match just <b>. Use lazy quantifiers when you need to match the shortest possible string.

More Free Tools

AI Regex Generator JSON Formatter Text Diff String Case Converter URL Encoder/Decoder

Need AI-Powered Dev Tools?

Explore the MatrixClawAI API — automate your workflow with AI agents.

Explore API →