Regex Tester

Test a regular expression against your text and see every match and capture group highlighted, right in your browser.

Quick reference
. any character
\d digit
\w word character
\s whitespace
[abc] one of a, b, c
[^abc] not a, b, c
[a-z] range
\b word boundary
^ start of line
$ end of line
a* 0 or more
a+ 1 or more
a? 0 or 1
a{2,5} 2 to 5 times
a+? lazy (as few as possible)
a|b a or b
(abc) capture group
(?<name>abc) named group
(?:abc) non-capturing
(?=abc) followed by
g all matches
i ignore case
m ^ $ per line
s . matches newline

Suggested tools

Text Compare

Compare two texts and see the differences highlighted line by line and word by word.

TEXT
Open Tool

Remove Duplicate Lines

Remove duplicate lines from a list — dedupe text with case, trim, sort and keep-first/last options.

TEXT
Open Tool

Compare Lists

Find items that are in both lists, only in the first, or only in the second.

TEXT
Open Tool

Case Converter

Convert text to UPPER, lower, Title, camel, snake, kebab case.

TEXT
Open Tool

JSON Formatter

Beautify, minify and validate JSON instantly in your browser.

JSON
Open Tool

Cron Parser

Explain a cron expression and preview its next run times.

CRON
Open Tool

About Regex Tester

Regex Tester lets you build and debug regular expressions against your own text, with every match highlighted as you type, capture groups and named groups listed, and a replacement preview using $1 or $<name>. It uses JavaScript's regex engine with the g, i, m, s, u and y flags.

Patterns run in a separate worker with a time limit, so a runaway pattern (catastrophic backtracking) is stopped instead of freezing the page. A quick-reference panel lists the most-used syntax. It runs entirely in your browser, so nothing you paste is uploaded.

How to use Regex Tester

  1. Type your pattern and choose flags.
  2. Paste the test text — matches are highlighted live.
  3. Optionally enter a replacement to preview the result.

Key features

  • Live highlighting of every match
  • Capture and named groups listed
  • Replacement preview with $1 / $<name>
  • Protection against runaway patterns

Example

Pattern [6-9]\d{9} with the g flag — a 10-digit Indian mobile number starting with 6, 7, 8 or 9.

Input
Call 9876543210 or 8123456789. Old number: 12345.
Output
Match 1: 9876543210 (position 5)
Match 2: 8123456789 (position 19)

When to use Regex Tester

  • Building a validation pattern for phone numbers, PIN codes or IDs.
  • Testing a search-and-replace before running it on many files.
  • Extracting values such as order numbers from logs.

Tips and common problems

  • Add the g flag to see every match, and m when ^ and $ should work per line.
  • Use ^ and $ to match the whole value when validating input.
  • Avoid nested quantifiers such as (a+)+ — they can run for a very long time.

Frequently asked questions

Most common syntax is the same, but details differ (lookbehind support, named-group syntax, flags). Test in your target language before shipping.

Guides