1. Home
  2. Developer
  3. Regex Tester

Regex Tester

Test regular expressions with live highlighting, capture groups and replace.

Runs in your browser
Try:
//g

Matches

Enter a pattern.

Match details

Regex cheat sheet
.Any character except a line break
\d \w \sDigit, word character, whitespace
\D \W \SNot a digit, word character, whitespace
[abc] [^abc] [a-z]One of, not one of, a range
^ $Start and end of text (or line with m)
\bWord boundary
* + ?0 or more, 1 or more, 0 or 1
{3} {2,5} {2,}Exactly 3, 2 to 5, 2 or more
*? +?Lazy (as few as possible)
(abc)Capture group
(?<name>abc)Named group
(?:abc)Group without capturing
a|ba or b
(?=x) (?!x)Followed by / not followed by x
(?<=x) (?<!x)Preceded by / not preceded by x

What is the Regex Tester?

Write a regular expression and see every match highlighted in your test text as you type, with the position and capture groups of each match listed below. Add a replacement to preview a search-and-replace before running it in your code.

It uses JavaScript’s own regex engine, the same one used by browsers, Node.js and React Native, and includes ready-made patterns for common Indian formats such as mobile numbers, PIN codes, PAN, GSTIN and IFSC codes. Patterns run in the background, so one that takes too long is stopped instead of freezing the page.

How to use it

  1. Type a pattern, or pick a ready-made one.
  2. Choose flags, such as g to find all matches or i to ignore case.
  3. Type or paste test text; matches are highlighted as you type.
  4. Optionally add a replacement to preview the result.

Example

Input
Pattern: \b[6-9]\d{9}\b   Text: Call 9876543210 or 1234567890
Output
1 match: 9876543210 at position 5

Features

  • Live highlighting. Every match is highlighted in the test text as you type.
  • Groups. Numbered and named capture groups for every match.
  • Replace preview. Use $1, $<name> and $& in the replacement and see the result instantly.
  • Indian presets. Mobile number, PIN code, PAN, GSTIN and IFSC, plus email, URL, date, IP and colour.
  • Safe to experiment. Patterns that take too long are stopped automatically.
  • Cheat sheet. A quick reference of the most-used regex syntax.

Frequently asked questions

Which regex flavour does this use?

JavaScript (ECMAScript) regular expressions, as used in browsers, Node.js, Deno and React Native. Most syntax is shared with Java, Python, PHP and Kotlin, but some features differ, such as lookbehind support and named group syntax in older engines.

Why does my pattern only find one match?

Without the g (global) flag, a regular expression stops at the first match. Turn on g to find all of them.

What do ^ and $ match with the m flag?

Normally ^ and $ match only the start and end of the whole text. With m (multiline) they match the start and end of every line, which is what you want when testing one value per line.

What is catastrophic backtracking?

Some patterns, such as (a+)+$, can take exponentially long on certain inputs. This tool stops any pattern that runs longer than a second and tells you; rewrite the pattern to avoid nested repetition.

Is my text uploaded?

No. Everything runs in your browser.

Last updated · Free, no sign-up, runs in your browser.

Free for everyone, kept free by you.

No paywall, no sign-up and no watermarks. If a tool saved you time, you can chip in any amount by UPI to keep Nova Free Tools running.

Esc
↑↓ move↵ openEsc close