Regex Tester

Developer·Free · in browser

Regex Tester

Test a JavaScript regular expression against sample text, see every match with its position and capture groups, and get real errors for invalid patterns.

Regex Tester
All tools

A regex tester runs a regular expression against sample text and highlights every match and capture group as you type. It uses the browser's native JavaScript engine, so what you see is exactly what your JavaScript code will do.

Runs entirely in your browser · no signup · nothing is uploaded · updated 2026-08-29

//

How to use it

  1. 1.Enter your pattern and toggle the flags you need.
  2. 2.Paste text to test it against.
  3. 3.Matches, positions and capture groups update as you type.

Frequently asked questions

Which regex flavour is this?

JavaScript's, via the native RegExp engine. Most syntax is shared with PCRE, but lookbehind, named groups and unicode property escapes differ in support across languages.

What does the g flag change?

Without it, only the first match is returned. With it, the engine continues from the end of each match. It is the flag people forget most often.

Why does my pattern hang the page?

Catastrophic backtracking - nested quantifiers like (a+)+ against a long non-matching string. We cap the match loop, but the real fix is to rewrite the pattern to avoid ambiguity.

Do I need to escape forward slashes?

Not here - you are entering the pattern body without delimiters. In a JavaScript literal you would need to escape them.

Why does my regex work here but not in Python?

Flavour differences. JavaScript has no lookbehind in older engines, no atomic groups, and different Unicode property syntax. Test in the flavour you will ship in.

What is the difference between greedy and lazy matching?

Greedy quantifiers like .* take as much as possible then backtrack; lazy ones like .*? take as little as possible then expand. For matching inside delimiters, lazy is almost always what you want.

How do I match across multiple lines?

The m flag makes ^ and $ match at each line boundary. The s flag makes . match newlines. They are different things and you often need both.

Should I parse HTML with regex?

No. HTML is not regular and any pattern that appears to work fails on nested or malformed markup. Use DOMParser in the browser or a real parser on the server.

The guide behind this tool

Tools that pair with this one

Built something?

RankCert is a weekly launch board where products rank on domain control we verify ourselves - not upvotes. Listing is free and the link is dofollow whether or not you display our badge.