Skip to content
LovTools
EN

Regex Tester

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

Processed locally on your device — nothing is uploaded.

About the Regex Tester

Regular expressions are powerful but easy to get wrong. Type a pattern and a test string, and every match is highlighted instantly, with a table showing positions and capture groups — including named groups like (?<year>\d{4}).

Toggle the g, i, m, s and u flags with one click, preview a replacement using $1 or $<name>, and use the quick reference when you cannot remember the syntax. The tester uses your browser’s own JavaScript engine, so results match what your code will do.

How to use the Regex Tester

  1. Type your pattern in the expression box.
  2. Paste or type a test string and toggle flags.
  3. Inspect highlighted matches and groups, and optionally try a replacement.

Features

  • Live match highlighting
  • Capture and named groups table
  • g, i, m, s, u flags
  • Replacement preview
  • Built-in cheat sheet
  • Clear syntax error messages

Supported formats

  • JavaScript (ECMAScript) regex syntax

Frequently asked questions

Is my code uploaded?

No. Formatting and minifying run in your browser, so proprietary code and secrets never leave your device.

Does this work for Python or PHP regex?

Most basic syntax is shared, but some features differ (lookbehind rules, flags, named-group syntax). Results reflect JavaScript.

Why do I only see one match?

Turn on the g (global) flag to find all matches instead of just the first.

Added · Last reviewed · Maintained by Sohail Khax · How we test tools