Regex Tester

Enter a regex pattern to see matches in text in real time.

Category: Dev Tools

When to use?

Use it to write email/phone validation regex, or to test patterns that extract values from logs. Adjust patterns while seeing matches live.

How to use

  • Enter the regex pattern.
  • Choose flags (g, i, m, s).
  • Enter test text.
  • Matches are highlighted and group captures are shown.

Input Explanation

Enter only the pattern without /pattern/ format. Choose flags separately.

Calculation Basis

It dynamically builds a JavaScript new RegExp(pattern, flags) from the pattern and flags, runs matchAll()/exec() on the text, and renders match indices and capture groups in a highlight UI.

Usage Examples

  • Validate patterns - Test input-validation regex for emails, phone numbers, etc.
  • Extract text - Verify regex that extracts pattern values from logs.
  • Quick pre-deploy check - Check inputs and output to reduce errors before dev/ops work.

Examples

  • Pattern \d+ → matches "123", "456" in "abc123def456"
  • Pattern (\w+)@(\w+\.\w+) → extract email addresses

Cautions

  • Generated output is for reference; test carefully before production use.
  • Regex syntax follows the JavaScript engine, which can differ from other languages.

Guides

Regex basics

A regex has a pattern and flags (g=global, i=ignore case, m=multiline). Enter a pattern and matches highlight in real time.

Common patterns

Email is roughly [^@]+@[^@]+\.[^@]+, numbers \d+, whitespace \s, word boundary \b. Try replacing matches in the regex replace tester.

FAQ

Which flags are supported?

g (global), i (ignore case), m (multiline), s (dotAll).

Are group captures shown?

Yes, matched group captures are shown too.

Do matches update live?

Yes. Editing the pattern or text recalculates matches instantly.

What regex syntax is used?

The JavaScript regex engine, so write JS-style syntax. Some expressions differ from other languages.

Related Tools

  • Regex Replace Tester - Apply a regex pattern and replacement value to see the result.
  • Text Extractor - Automatically find and extract emails, URLs, phone numbers, and numbers from text.
  • JavaScript Formatter - Tidy JavaScript code for readability using Prettier rules.
  • JSON Formatter - Beautify or minify JSON strings instantly and check for validity errors.
  • UUID Generator - Generate up to 20 cryptographically secure UUID v4 values at once.
  • Password Generator - Generate secure random passwords in the browser by choosing length, character set, and count.