Skip to main content

Regex Tester

JavaScript regular expressions with live match highlighting, capture groups, and a replacement preview. Runs in your browser.

Flags

Pattern1 match

Test string1 match highlighted

Matches1

Cheatsheet

How to Use the Regex Tester

Build, test, and debug JavaScript regular expressions in your browser.

Quick Start

  • Type a regular expression in the Pattern field.
  • Toggle flags (g, i, m, s, u, y) to control matching behavior.
  • Paste or type your text into the Test String box — matches highlight as you type.
  • Inspect each match, its position, and any capture groups in the Matches panel.
  • Turn on Replace mode to preview the result of String.replace with backrefs like $1, $<name>, and $&.
  • Pick a preset to start from a common pattern (email, URL, UUID, hex color, semver, and more).

Core Features

  • Live Highlighting: See every match in context as you edit the pattern or test string.
  • Capture Groups: View numbered and named capture groups for every match.
  • Replacement Preview: Test substitution patterns with full JavaScript replacement-string semantics.
  • Pattern Presets: Start from validated patterns for emails, URLs, IPs, dates, and more.
  • Cheatsheet: A quick reference for character classes, anchors, quantifiers, and lookarounds.
  • Privacy First: Everything runs in your browser — your patterns and test text never leave the page.

Common Use Cases

  • Form Validation: Build and verify patterns for emails, phone numbers, and ZIP codes.
  • Log Parsing: Extract timestamps, IPs, and request paths from server logs.
  • Code Refactoring: Preview find-and-replace operations before running them across a codebase.
  • Data Cleaning: Strip whitespace, normalize separators, and reformat strings.
  • Learning Regex: Experiment safely with the cheatsheet alongside your pattern.
Real-timePrivateDeveloper-Friendly