Free Online Regex Tester & Debugger

Test regular expressions in real-time. See matches and capture groups instantly.

Regular Expression
Presets:
//g
Test String
Enter text to test against the regex
Matches
0 matches
Matches will be highlighted here...

How the Regex Tester Works

Our regex tester uses JavaScript's built-in regular expression engine to validate and test your patterns in real-time. As you type, matches are instantly highlighted and capture groups are displayed.

Features

Test patterns with global, case-insensitive, multiline, and dotAll flags. See individual matches with their positions and capture groups. Use preset patterns for common validations like email, URL, and phone numbers.

Privacy First

All testing happens locally in your browser. Your regex patterns and test data never leave your device.

Related free tools

The Complete Guide

About the Regex Tester

Regular expressions are one of the highest-leverage skills a developer can learn. A three-line regex can replace a hundred lines of imperative parsing code. But regex syntax is famously terse and unforgiving — one misplaced backslash and your pattern matches everything, or nothing. That's why every regex expert keeps a tester open in another tab.

Our Regex Tester runs your pattern against your test string in real time using the browser's native JavaScript RegExp engine. Every keystroke updates the results: overall matches highlighted in the string, all captured groups broken out separately, and a replacement preview if you turn that on. The interface makes it obvious which flags (g, i, m, s, u, y) are active.

The right sidebar has a cheat sheet covering character classes (\d, \w, \s), quantifiers (?, +, *, {n,m}), anchors (^, $, \b), lookarounds ((?=...), (?<!...)), and back-references — the concepts you use daily. Below that are common recipes: email addresses, URLs, phone numbers, IPv4 addresses, hex colors, ISO dates — proven patterns you can paste and adapt.

How to use Regex Tester

1

Enter your pattern

Type your regex in the pattern box. You don't need slashes — just the pattern content. Choose flags from the toggles (g = global, i = case-insensitive, m = multiline, s = dotall, u = unicode).

2

Paste your test text

Copy any text you want to test the pattern against: log lines, user input, HTML, code, or a paragraph. Multiple lines are fine.

3

Watch matches highlight

Every match is highlighted inline in the test text. If you have capture groups (using parentheses), they appear numbered below the match list.

4

Test replacements

Toggle "Show replacement" and enter a replacement string. Use `$1`, `$2`, etc. to reference capture groups. The full replaced output appears below.

5

Copy or share

Use the copy button to copy the pattern in `/pattern/flags` format for pasting into your JavaScript code. The URL updates so you can bookmark or share a pattern.

Common Use Cases

Form input validation

Write patterns to validate emails, phone numbers, URLs, or custom identifiers. Test against 20 sample inputs to catch edge cases.

Log parsing

Extract structured fields from unstructured log lines. A single regex with capture groups turns `"[2026-02-14 12:00] INFO userId=abc"` into three fields.

Code refactoring with sed/rg

Prototype find-and-replace patterns here before running them across your codebase with grep/ripgrep/sed. Fewer regrettable commits.

Data cleanup

Strip HTML tags, normalize whitespace, remove non-ASCII characters — all with well-crafted regexes.

URL routing

Debug the pattern matching used by React Router, Next.js dynamic routes, or Express route parameters.

SEO redirects

When migrating a website, write regex patterns to map old URLs to new ones in your .htaccess or nginx config.

Frequently Asked Questions

Common questions about Regex Tester.

Related searches:

regex tester
regex debugger
regular expression
regex101 alternative
regexr
regex online
regex playground
javascript regex
regex validator