Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Regex Tester

Regex Tester

Test and debug regular expressions with live matching, capture group highlighting, replace mode, and a built-in cheatsheet.

What Is Regex Tester?

Regex Tester is an online tool for testing and debugging regular expressions (regex). Enter a pattern, type or paste your test string, and instantly see all matches highlighted in real time.

Whether you're validating email addresses, parsing log files, or extracting data from text, this tool helps you build and verify regex patterns quickly without writing code.

Live Matching

See matches highlighted as you type, no need to click a button. Instant feedback for rapid pattern development.

Capture Groups

Each group gets its own color for easy identification. Visual clarity for complex patterns.

Replace Mode

Test substitution patterns with instant preview. Perfect for text transformation workflows.

Built-in Cheatsheet

Quick reference for regex syntax without leaving the page. Learn while you build.
Your Data Stays Private: All processing happens in your browser. No uploads, no tracking — your text and patterns never leave your device.

Common Patterns Library

Load popular regex patterns with one click to jumpstart your work:

  • Email validation patterns
  • URL and domain matching
  • IP address extraction
  • Phone number formats
  • Date and time patterns
  • HTML tag parsing

How to Use Regex Tester

1

Enter Your Pattern

Type your regular expression between the / delimiters. The tool validates your pattern in real time and shows errors immediately if the syntax is invalid.

2

Set Flags

Click the flag buttons to toggle options:

  • g (Global) — Find all matches, not just the first one
  • i (Case Insensitive) — Ignore uppercase/lowercase differences
  • m (Multiline) — ^ and $ match the start/end of each line
  • s (Dotall) — . matches newline characters too
  • u (Unicode) — Enable full Unicode matching
3

Enter Test Text

Type or paste text in the Test String area. Matches are highlighted instantly with color-coded capture groups.

4

Review Matches

The Match Details panel shows each match with its position and capture group values. A badge displays the total match count.

Using Replace Mode

Click the Replace button to enable substitution. Enter a replacement pattern using $1, $2, or ${name} for group references. The result preview updates in real time.

Quick Start Tip: Use the Common Patterns dropdown to load a preset regex with sample text. Options include Email, URL, IPv4 Address, Phone Number, Date, Hex Color, HTML Tag, and more.

Features

Live Matching & Highlighting

As you type your regex pattern or modify the test string, matches are highlighted directly in the text area. No need to click a button — results update automatically with debounced input for smooth performance.

Color-Coded Capture Groups

Each capture group is highlighted with a distinct color (up to 5 colors), making it easy to see which parts of the text are captured by which group.

  • Numbered groups ($1, $2)
  • Named groups (${name})

Match Details Panel

View a detailed breakdown of every match:

  • Full match text and character positions
  • Numbered and named capture group values
  • Color-coded group tags for visual clarity

Replace Mode

Toggle the Replace panel to test substitution patterns. Enter replacement text with group references and see the result instantly. Copy the output with one click.

Common Patterns Library

Choose from 10 preset patterns for common use cases. Each pattern comes with sample text so you can see it in action immediately:

Email & URL

Validate email addresses and extract URLs from text

IP & Phone

Match IPv4 addresses and phone number formats

Date & Time

Parse date and time patterns in various formats

HTML Tag

Extract and parse HTML tags from markup

Hex Color

Match hexadecimal color codes (#RGB, #RRGGBB)

Username & Password

Validate usernames and strong password requirements

Built-In Cheatsheet

A collapsible reference panel covers 6 categories of regex syntax for quick lookup while you work:

Character Classes

Match specific types of characters: \d (digits), \w (word characters), \s (whitespace), . (any character), and custom character sets with [abc] or ranges [a-z].

Quantifiers

Control how many times a pattern repeats: * (0 or more), + (1 or more), ? (0 or 1), {n} (exactly n), {n,m} (between n and m times).

Anchors

Match positions in text: ^ (start of string/line), $ (end of string/line), \b (word boundary), \B (non-word boundary).

Groups & References

Capture and reference parts of matches: (pattern) (capturing group), (?<name>pattern) (named group), (?:pattern) (non-capturing group), \1 or $1 (backreferences).

Lookaround

Match based on what comes before or after: (?=pattern) (positive lookahead), (?!pattern) (negative lookahead), (?<=pattern) (positive lookbehind), (?<!pattern) (negative lookbehind).

Flags

Modify how the regex engine works: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode).

Frequently Asked Questions

Which regex engine does this tool use?

This tool uses the JavaScript RegExp engine built into your browser. It supports all modern regex features including lookahead, lookbehind, named groups, and Unicode properties.

Is my data safe?

Yes. All regex matching and text processing happens entirely in your browser. Nothing is sent to any server. You can verify this by using the tool offline after the page loads.

What do the flag buttons mean?

  • g (Global) — Finds all matches instead of stopping at the first
  • i (Case Insensitive) — Makes matching case-insensitive
  • m (Multiline) — Makes ^ and $ match line boundaries
  • s (Dotall) — Makes . match newlines
  • u (Unicode) — Enables full Unicode support

How do capture groups work?

Parentheses () in your pattern create capture groups. Each group captures a portion of the match, accessible as $1, $2, etc. in replacements. Named groups use (?<name>...) syntax and can be referenced as ${name}.

Example: Pattern (\w+)@(\w+)\.com captures username as $1 and domain as $2 from email addresses.

What does "No match" mean?

It means your regex pattern doesn't match any part of the test string. Common solutions:

  • Check your pattern syntax for errors
  • Ensure the correct flags are set (e.g., i for case-insensitive)
  • Verify the test string contains the expected text
  • Try simplifying your pattern to isolate the issue

Can I use this for other programming languages?

JavaScript regex syntax is very similar to other languages (Python, Java, PHP, C#). However, there may be subtle differences in advanced features like lookbehind support or Unicode handling.

Note: This tool is best suited for testing patterns used in JavaScript environments. Always verify your regex in the target language's environment for production use.
Processed locally
/ /
Type a regex pattern between the / delimiters and enter test text below
Click the flag buttons (g, i, m, s, u) to toggle regex flags
Use Common Patterns dropdown to quickly load popular regex patterns with sample text
Enable Replace mode to test substitution patterns like $1, $2, or ${name}
Open the Cheatsheet for a quick reference of regex syntax
Capture groups are color-coded in the test string and match details
All processing happens locally in your browser
Want to learn more? Read documentation →
1/8
Start typing to search...
Searching...
No results found
Try searching with different keywords