Home › Developer Tools › Regex Tester
.*

Free Online Regex Tester

Build and debug JavaScript regular expressions with live match highlighting.

Your data stays on your device. This tool processes everything directly in your browser. Nothing you enter is sent to our servers.

Tip: you can paste a literal like /ab+c/gi into the pattern box.

Highlighted matches

        

Match details

#MatchIndexGroups
No matches yet.

Replace

Use $1, $2 or $<name> to insert captured groups.

Result

        

How it works

  1. Type a regular expression, or paste one like /ab+c/gi.
  2. Toggle flags such as g (global) and i (ignore case).
  3. Enter test text — matches are highlighted as you type.
  4. Inspect capture groups in the table and try a replacement with $1, $2 or $<name>.

Frequently asked questions

Which regex flavour does this tester use?

It uses your browser's JavaScript (ECMAScript) regular expression engine — the same one used by JavaScript, TypeScript and Node.js. Most syntax is shared with other languages, but features like lookbehind and named groups can differ.

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

g finds all matches instead of the first, i ignores case, m makes ^ and $ match at every line, s lets . match newlines, and u enables full Unicode matching (needed for emoji and \p{…} classes).

Why was my pattern stopped for taking too long?

Patterns with nested quantifiers like (a+)+ can take exponential time on some inputs ("catastrophic backtracking"). The tester runs your regex in a background worker and stops it after 1.5 seconds so your browser never freezes.

How do I use capture groups in a replacement?

Wrap part of the pattern in parentheses, then use $1, $2… in the replacement. Named groups (?<name>…) can be inserted with $<name>, and $& inserts the whole match.

Test regular expressions as you type

Regular expressions are powerful but easy to get subtly wrong. This regex tester highlights every match in your sample text as you edit the pattern, lists each match with its position and capture groups, and previews a find-and-replace.

Quick regex reference

  • \d digit, \w word character, \s whitespace, . any character
  • * zero or more, + one or more, ? optional, {2,4} between 2 and 4
  • ^ start and $ end of input (or of each line with the m flag)
  • [abc] any of a, b or c; [^abc] anything except them
  • (…) capture group, (?:…) non-capturing group, (?<name>…) named group
  • (?=…) lookahead, (?<=…) lookbehind

Safe testing

Poorly written patterns can take seconds or even minutes on certain input — a problem known as catastrophic backtracking, which has caused real website outages. Your pattern runs in a background worker with a time limit, so the page always stays responsive and you learn about the risk before it reaches production.

Keyboard shortcuts

/
Search all tools
?
Show this help
Esc
Close search or dialogs
Ctrl + Enter
Run the tool's main action (Format, Generate, Calculate…)
Ctrl + K
Clear the tool's input

Tool shortcuts work while you're using a tool, including inside its text boxes.