๐Ÿ”Ž

Regex Tester

Test regular expressions live, highlight matches, inspect capture groups, and understand pattern tokens faster.

Match Preview

โ€”

Matches

No matches yet.

Pattern Explanation (quick)

Basic token explanation appears here.

About Regex Tester

Regular expressions (regex) are powerful search patterns used for validation, extraction, and transformation of text. This tester lets you debug patterns live with visual match highlighting and capture-group inspection.

How to Use

  1. Enter your regex pattern in the pattern field (without surrounding slashes).
  2. Set any flags: g (global), i (case-insensitive), m (multiline).
  3. Type or paste your test string in the text area.
  4. Matches are highlighted in real time and listed below with their positions and capture groups.

How It Works

The tool uses JavaScript's built-in RegExp object to execute the pattern against your test string. Match positions are extracted and used to highlight spans within the text. Capture groups are displayed for each match.

Example

Pattern: \b\d{4}\b with flag g
Test string: Call 1234 or 5678 but not 123 or 12345
Matches: 1234 and 5678 (exactly 4-digit words).

Frequently Asked Questions

The tool uses JavaScript's ECMAScript regex engine. This supports most common regex features but differs from PCRE (Python, PHP) in some edge cases like lookbehind support and Unicode handling.
Without the g (global) flag, regex stops after the first match. Add the g flag to find all matches in the string.
Escape special characters with a backslash. To match a literal dot use \., a literal bracket use \[, and a literal backslash use \\.
Yes. Add the m flag to make ^ and $ match the start and end of each line rather than the whole string.