Skip to content
OnDevKit

Regex Tester

Test regular expressions live: highlighted matches, capture groups, replace, and a plain-English explanation.

  • Never uploaded
  • Works offline
  • Free, no sign-up

Pattern and text

JavaScript flavour
//g
Global

Matches

Write a pattern to see matches, capture groups and a plain-English explanation.

Processed on this device. Nothing is sent to a server.

How to use the Regex Tester

  1. Step 1Write a patternOr start from a preset: email, URL, date, IP, UUID.
  2. Step 2Paste test textMatches are highlighted as you type.
  3. Step 3Check groups and replaceSee every capture group and preview replacements.

Reading and testing regular expressions

Regular expressions are compact and hard to read later. The explanation breaks a pattern into steps, such as “a digit, exactly 4 times” or “group 1 named year”, so you can check that it says what you meant. Matches are highlighted in the text, and each capture group is listed with its value and position.

The tester uses your browser’s JavaScript engine, so results match what Node.js and browsers do, including named groups, lookbehind and Unicode property escapes like \p{L} with the u flag. Other flavours (PCRE, Python, Java, .NET) agree on most basics but differ in details such as possessive quantifiers and inline flags.

Patterns run in a separate worker with a one-second limit. A pattern like (a+)+$ can take exponential time on some inputs (“catastrophic backtracking”), which can freeze a page or take down a server. Here it’s stopped and explained instead.

Questions

Is my test text sent anywhere?

No. Patterns run in your browser, so you can safely test against real logs or data.

How do I use a capture group in the replacement?

$1, $2 and so on insert numbered groups, $<name> inserts a named group, $& inserts the whole match, and $$ inserts a literal dollar sign.

Why does my pattern match only once?

Turn on the g (global) flag to find every match. Without it, JavaScript stops after the first one.

What is catastrophic backtracking?

When a pattern has nested repetition, like (a+)+ or (.*,)*, a failing match can make the engine try an exponential number of ways to split the text. Make inner parts specific (for example [^,]* instead of .*) or avoid nesting quantifiers.

Related tools