Skip to content

Code tool

Regex Tester

Write a pattern, paste some text, and see every match, capture group and replacement as you type.

Runs entirely in your browser. Nothing you paste is uploaded.

Flags
Matches highlighted

      

Regex Tester by YegappanFree tool. Open the full page for the guide.

How to use the Regex Tester

  1. Type your pattern without the surrounding slashes and tick the flags you need.
  2. Paste the text you want to test. Matches are highlighted and listed with their position and groups.
  3. Optionally add a replacement to preview the result, then copy the finished /pattern/flags.

How this regex tester behaves

A regex tester checks a regular expression against sample text and shows what it matches. This online regex tester uses the JavaScript engine in your browser and highlights every match and capture group as you type.

The tester uses your browser’s own JavaScript regular expression engine, so what matches here is exactly what will match in JavaScript, TypeScript and Node.js code. Named groups such as (?<year>\d{4}), lookbehind and Unicode escapes are supported wherever your browser supports them.

Matching runs in the background. If a pattern backtracks without end, a common result of nested quantifiers like (a+)+, it is stopped after 1.5 seconds and reported, instead of freezing the tab.

Remember the g flag: without it a pattern only finds its first match. Other languages share most of this syntax, but details such as lookbehind and possessive quantifiers differ in PHP, Python and Go.

Common questions

How do I test a regular expression online?

Enter the pattern and its flags, then paste the text to search. Matches are highlighted and each capture group is listed.

Which regex flavour does this use?

JavaScript (ECMAScript). It is the flavour used by browsers and Node.js.

Why do I only get one match?

The g (global) flag is off. Without it, a JavaScript regex stops after the first match.

What do $1 and $<name> mean in the replacement?

$1 inserts the text captured by the first group, and $<name> inserts a named group. $& inserts the whole match.

Is my text sent anywhere?

No. The pattern and the test text stay in your browser.

Guides for the Regex Tester

Related tools