DeveloperKit

Regex Tester

Test regular expressions with live match highlighting, capture groups, and replace. Free, private, and 100% in your browser.

Regular Expression

Flags

Enter a pattern to start.

Test String

Match Details

Matches and capture groups will appear here.

Test Regular Expressions Online

A regular expression (regex) is a pattern that describes text: email addresses, dates, log lines, or anything else with a structure. This regex tester runs your pattern against sample text instantly and highlights every match, so you can build and debug expressions before you use them in JavaScript, TypeScript, Node.js, or most other languages.

Features

  • Live highlighting

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

  • Capture groups

    See each match with its index and the value of every numbered and named group.

  • Find and replace

    Preview replacements with $1, $<name>, and $& references, then copy the result.

  • All JavaScript flags

    Toggle g, i, m, s, u, and y, with a short explanation of each.

  • Safe from freezes

    Patterns run in a background worker with a time limit, so catastrophic backtracking cannot hang the page.

  • Private by design

    Your pattern and test data never leave your browser.

How to Test a Regex

  1. Type your pattern between the slashes, or pick one from Common patterns.
  2. Turn flags on or off: g for all matches, i to ignore case, m for multiline.
  3. Paste your test text. Matches are highlighted and listed with their groups.
  4. Switch to Replace to preview a replacement, then copy the result or the regex literal.

Regex Cheat Sheet

Characters

.
Any character except a line break (any character with the s flag)
\d \D
Digit / not a digit
\w \W
Word character [A-Za-z0-9_] / not a word character
\s \S
Whitespace / not whitespace
[abc] [^abc]
Any of a, b, c / anything except a, b, c
[a-z]
Character range
\p{L}
Any Unicode letter (needs the u flag)

Anchors

^ $
Start / end of the string (of each line with the m flag)
\b \B
Word boundary / not a word boundary

Quantifiers

* + ?
0 or more / 1 or more / 0 or 1
{3} {3,} {3,5}
Exactly 3 / 3 or more / 3 to 5
*? +?
Lazy: match as few as possible

Groups and lookaround

(abc)
Capture group
(?<name>abc)
Named capture group
(?:abc)
Non-capturing group
\1 \k<name>
Backreference to a group
a|b
a or b
(?=abc) (?!abc)
Lookahead / negative lookahead
(?<=abc) (?<!abc)
Lookbehind / negative lookbehind

Frequently Asked Questions

Which regex flavor does this tester use?

It uses your browser's JavaScript (ECMAScript) regular expression engine, the same one used by Node.js, TypeScript, and front-end code. Most syntax is shared with PCRE, Python, Java, and .NET, but features like possessive quantifiers and recursion are not available in JavaScript.

Why does my regex only find one match?

Without the g (global) flag, a JavaScript regex stops at the first match. Enable g to find all matches.

What does the 'Stopped after 2 seconds' error mean?

The pattern caused catastrophic backtracking: the engine tried an exponential number of ways to match. This usually comes from nested quantifiers such as (a+)+ or (.*)*. Make the pattern more specific, for example by replacing .* with a negated character class like [^,]*.

How do I use capture groups in a replacement?

Switch to Replace mode. Use $1, $2, … for numbered groups, $<name> for named groups, $& for the whole match, and $$ for a literal dollar sign.

Is my test data sent to a server?

No. Matching and replacing happen entirely in your browser.

  • Text Diff Checker

    Compare two texts or code snippets side by side, with changed words highlighted and a downloadable patch.

  • String Case Converter

    Convert text and variable names to camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and more.

  • Word, Character & Byte Counter

    Count words, characters, sentences, lines, and UTF-8 bytes as you type, with reading time and length limits.

  • JSON Formatter

    Beautify, minify, and validate JSON instantly with exact line and column error reporting.