Free · no sign-up · updated

No. 12 · PDF, image, text and code

JavaScript regex tester

Enter a JavaScript pattern without slash delimiters, select flags and inspect highlighted matches.

Flags

Use $1, $2 or $<name> for captures, $& for the full match, and $$ for a dollar sign.

Matching…

JavaScript RegExp. Matching runs in a worker terminated after about 500 ms; at most 1,000 matches are displayed. With g off, only the first match is returned. Flag y requires matches at the current cursor, initially zero.

Enter a JavaScript pattern without slash delimiters, select flags and inspect highlighted matches. Read numbered and named capture groups and preview replacements while a worker bounds matching time.

What is a regex tester?

The regex tester runs JavaScript RegExp patterns against your text in a disposable Web Worker. It highlights matches, lists capture groups and previews replacement strings. Each worker is terminated after about 500 ms, with caps on pattern length, input length, replacement size and displayed matches.

Features

  • JavaScript g, i, m, s, u and y flags
  • Live highlighting and capture groups
  • Replacement preview and copy
  • 500 ms disposable-worker timeout
  • Clear invalid-pattern and size errors

How to use the regex tester

  1. Enter Pattern without slash delimiters.
  2. Choose Flags and paste Test text.
  3. Optionally enter Replacement using capture references.
  4. Read Highlighted matches, the capture table and Replace preview.
  5. Simplify the pattern if matching times out.
Full guide · 5 min read · examples and common mistakes How to Test JavaScript Regex Matches and Replacements

Worked example

Pattern (\w+)=(\d+), flag g and text tea=12 milk=3 produce two matches at indexes 0 and 7. Replacement $1:$2 previews tea:12 milk:3. Turning off g limits the operation to the first match.

Bounds and engine scope

Use at most 1,000 pattern characters, 20,000 input characters, 2,000 replacement characters and 1,000 matches. Empty matches show a marker. Indexes count UTF-16 code units. This is your browser's JavaScript engine, so another regex engine may behave differently. ECMAScript RegExp specification.

Frequently asked questions

Should I include / at either end of the pattern?

No. Enter only the pattern body and choose flags using the checkboxes. Slashes in the field are treated as literal pattern content.

Why did matching stop after 500 ms?

The worker exceeded the time budget. Shorten the input or simplify overlapping quantifiers. A timeout does not prove that the pattern has no matches.

Why do I see only one match?

Without g, only the first match is returned. The sticky y flag also requires a match at the current cursor, initially position zero.

How do I insert a captured group?

Use $1 or $2 for numbered captures and $<name> for named captures. $& inserts the full match and $$ inserts a dollar sign.

Does this validate patterns for every language?

No. It uses the browser's JavaScript RegExp engine and supported flags. Check behavior again in the engine where your pattern will run.

Last updated 16 November 2026. Made by Criza Labs. Spotted a mistake? Tell us.

PDF & image

Text Difference Checker

Compare two texts by line or word, see added and removed counts, and switch between inline and side-by-side views.

PDF & image

JSON Formatter

Format, validate and minify JSON in your browser. Shows the line and column of any error, sorts keys and copies or downloads the result.

PDF & image

Case Converter

Convert text to UPPERCASE, lowercase, Sentence case, Title Case, camelCase, snake_case, kebab-case and more in one click, then copy.

Made by Criza Labs

Need a custom tool for your team or customers?

Criza Labs builds tools like this into websites, billing systems and internal apps: with your branding, your data and your workflow. Fixed scope, fixed price, and you own the code.