Regex Tester — Test JavaScript Regular Expressions Live

Write a pattern, paste your text, and see every match highlighted with capture groups and replace preview.

//g
Matches highlighted (2)
Contact: jane.doe@example.com, support@kaviforge.com Website: https://www.kaviforge.com/tools/regex-tester Server 192.168.1.20 went down on 2026-09-27 at 10:45. Brand colors: #0d9488 and #fff

Match details

#MatchIndexGroups
1jane.doe@example.com9—
2support@kaviforge.com31—

Quick answer

To test a regular expression, type the pattern into the KaviForge Regex Tester, choose flags (g, i, m, s, u, y), and paste your test text. Matches are highlighted instantly, and a table lists each match with its index and capture groups. Enter a replacement to preview String.replace results.

Regular expressions are powerful but easy to get wrong. A live tester lets you see immediately what a pattern matches — and what it misses — before you put it in code.

This tester uses your browser’s native JavaScript RegExp engine, so results match exactly what Node.js, React, and browser code will do, including named groups, lookbehind, and Unicode mode.

How to Test a Regex

  1. 1Enter your pattern between the slashes, or pick one from "Common patterns".
  2. 2Toggle flags such as g (global), i (ignore case), or m (multiline).
  3. 3Paste or type your test string.
  4. 4Review highlighted matches and the match details table with groups.
  5. 5Optionally enter a replacement (using $1 or $<name>) to preview the replaced text.

Features

Live Match Highlighting

Every match is highlighted as you type the pattern or text.

Capture & Named Groups

See numbered groups ($1, $2…) and named groups for each match.

All JavaScript Flags

g, i, m, s (dotAll), u (unicode), and y (sticky).

Find & Replace Preview

Test replacements with $1, $<name>, and $& backreferences.

Common Patterns Library

Email, URL, IPv4, date, hex color, phone, and more to start from.

Clear Error Messages

Invalid patterns show the exact JavaScript syntax error.

When to Use the Regex Tester

Validate form input

Build and test patterns for emails, phone numbers, postcodes, and usernames.

Extract data from logs

Pull IPs, timestamps, or error codes out of log lines with capture groups.

Search and replace in code

Preview complex replacements before running them in your editor or script.

Learn regex

Experiment with flags and groups and see results immediately.

About the Regex Tester

Patterns are compiled with new RegExp(pattern, flags) in your browser. Global and sticky searches iterate with exec and safely handle zero-length matches. Up to 1,000 matches are collected.

Very complex patterns with nested quantifiers can cause catastrophic backtracking on long inputs. If the page slows down, simplify the pattern or shorten the test text.

Regex Tester FAQs

How do I test a regular expression online?

Enter your pattern and test text in the KaviForge Regex Tester. Matches are highlighted instantly and listed in a table with their capture groups.

Which regex flavor does this tester use?

JavaScript (ECMAScript) regular expressions, using your browser’s built-in RegExp engine — the same one used by Node.js and all modern browsers.

What do the g, i, m, and s flags do?

g finds all matches instead of the first, i ignores case, m makes ^ and $ match at line breaks, and s lets . match newline characters.

How do I use named capture groups?

Write (?<name>pattern). The match table shows each named group, and you can reference it in replacements as $<name>.

How do I test a regex replacement?

Type the replacement text in the "Replace with" box. Use $1 for the first group, $<name> for named groups, and $& for the whole match.

Is my test data private?

Yes. Matching runs entirely in your browser.