Home / Tools / Regex Tester
Free tool · runs in your browser

Regex Tester

Test a regular expression against sample text with live highlighting, a match list, and every capture group broken out — including named groups. It runs on your browser's own RegExp engine, so what matches here is exactly what matches in JavaScript.

Highlighted matches

Match list with capture groups

How it works

This is the JavaScript engine, not PCRE

The tester uses your browser's built-in RegExp, which means results are exactly what you will get in JavaScript — and not necessarily what you will get in Python, PHP, Go or grep. Differences that bite in practice:

  • No lookbehind in older engines. (?<=x) works in current browsers but not in Safari before 16.4.
  • No atomic groups or recursion. PCRE's (?>...) and (?R) do not exist here.
  • \d is ASCII-only by default, unlike Python's Unicode-aware default.
  • Named groups use (?<name>...), the same syntax as .NET and modern Python.

What the flags do

  • g · global — find every match rather than stopping at the first. Without it you get one match.
  • i · ignore case — case-insensitive matching.
  • m · multiline — makes ^ and $ match at each line break rather than only at the start and end of the whole string.
  • s · dotall — lets . match a newline, which it does not do by default.
  • u · unicode — enables Unicode mode, needed for \p{...} property escapes and correct handling of characters outside the basic plane.

Catastrophic backtracking

Some patterns take exponential time on input that nearly matches. The classic shape is a repeated group that can itself repeat, such as (a+)+$ against a long run of as. This is a real denial-of-service vector when a pattern runs against user input.

Avoid nesting quantifiers over overlapping character classes, prefer specific classes over .*, and anchor patterns where you can. This tester caps itself at 10,000 matches so a runaway global pattern cannot hang the page, but it cannot protect you from a slow pattern.

What people use it for

  • Building a validation pattern and checking it against both valid and invalid examples.
  • Working out why a pattern isn't matching — usually a missing flag or an unescaped character.
  • Extracting fields from log lines with capture groups before writing the code.
  • Testing a find-and-replace pattern before running it across a codebase.
  • Checking a pattern from a tutorial behaves the way you expect on your own data.

Nothing is uploaded. This tool runs entirely in JavaScript in your browser. Your input is never sent to a server, never logged and never stored, and no account is required. Once the page has loaded you can go offline and it still works — open your browser's network tab and watch if you'd like to confirm it.

Frequently asked questions

Which regex flavour does this use?

JavaScript's, because it runs on your browser's own RegExp engine. Results match JavaScript exactly but may differ from Python, PCRE, Go or grep — particularly for lookbehind, atomic groups and the meaning of \d.

Why do I only get one match?

The global flag is off. Without g, matching stops at the first result. Tick g to find every match.

Why doesn't my dot match a newline?

By default . matches any character except a line terminator. Tick the s (dotall) flag to let it match newlines too.

How do I use named capture groups?

Write (?<name>pattern). Named groups are listed alongside the numbered ones in the match list below the highlighted text.

What is catastrophic backtracking?

A pattern that takes exponential time on input that nearly matches, such as (a+)+$ against a long run of a characters. It is a real denial-of-service risk when patterns run against user input. Avoid nesting quantifiers over overlapping classes.

Is my test text uploaded?

No. Matching happens entirely in your browser.

Tools that run where your code is

This page does its work in your browser because sending your data to a server to process it is a bad default. Catalase applies the same idea to AI coding: a free, open-source code editor that runs language models on your own machine through Ollama, with no account and no telemetry. Cloud models are there when you choose one, not by default.

Download Catalase freeWhat is Catalase?

Related tools

All 30 free developer tools →