Regex Tester

Quick Actions
JavaScript RegExp

Pick an example below, or click tokens on the left to build your pattern step by step.

/
/g
Quick insert
Flags

Explanation

Enter a valid pattern to see a step-by-step breakdown.

Enter a pattern and test string to see highlighted matches.

Upload TXT, CSV, or JSON as test text. Export match results as TXT or JSON.

Quick Reference

Click a token to insert at cursor

Character classes

Anchors

Quantifiers

Groups & logic

Escape

Tip: ⌘K opens tool search. Click explanation tokens to select pattern parts.

Regex Tester - Test Regular Expressions Online

Free regex tester with live highlights, capture groups, replace preview, split, and unit tests. JavaScript RegExp in your browser.

Enter pattern and test text. Switch Match / Replace / Split modes; save history, share links, export matches.

Writing regex without instant feedback leads to subtle bugs: greedy quantifiers matching too much, forgotten anchors causing partial matches, and unescaped special characters breaking patterns. A live tester shows exactly which parts of your text match, with position indices and capture group values.

WaiHub's Regex Tester runs JavaScript RegExp in your browser with match, replace, and split modes, live highlighting, capture groups, shareable URLs, pattern history, unit tests, and a library of proven templates. Your data never leaves your device.

  • Match, replace, and split modes
  • Real-time match highlighting
  • Capture groups and full-string validation
  • Shareable links and local history
  • Pattern library and unit tests
  • Privacy-first browser testing

Features

  • Match / Replace / Split tabs
  • Real-time regex testing as you type
  • Highlight all matches in test text
  • Substitution preview with $1, $& syntax
  • Split test string by pattern
  • Show match index, length, and groups
  • Full-input vs partial match indicator
  • Toggle flags: g, i, m, s, u, y
  • Pattern library with searchable templates
  • Quick-insert tokens and visual breakdown
  • Share link with encoded state
  • Save patterns to local history
  • Unit tests with pass/fail
  • Export matches as TXT, JSON, CSV
  • File upload for large text
  • Works locally in browser

How To Use

  1. Enter your regex pattern

    Type or paste your regular expression. Use quick-insert chips or the pattern library. Toggle flags like g (global) and i (case-insensitive).

  2. Paste test text

    Enter text in the test string panel. Matches highlight in real time in Match mode.

  3. Switch modes

    Use Replace to preview substitutions ($1, $2), or Split to break text by your pattern.

  4. Review matches and groups

    See positions, capture groups, and whether the pattern matches the entire input.

  5. Share or save

    Copy a share link, save to history, or export match values for your workflow.

Examples

Email validation

Pattern + Text

Pattern: [a-z]+@[a-z]+\.[a-z]+
Text: contact@example.com

Matches

Match: contact@example.com (index 0, length 19)

Extract numbers

Pattern + Text

Pattern: \d+
Text: Order #12345 costs $99

Matches

Matches: 12345, 99

Replace with groups

Pattern + Text

Pattern: (\w+)@(\w+)
Replace: $1 at $2
Text: user@example.com

Matches

user at example.com

FAQ

Is this regex tester free?
Yes. Completely free with no signup.
Is my data uploaded?
No. Regex testing runs entirely in your browser.
What regex engine is used?
JavaScript RegExp, the same engine used in browsers and Node.js.
How do I replace all matches?
Enable the g (global) flag in Replace mode. Without g, only the first match is replaced.
Can I share my pattern?
Yes. Use Copy share link — the URL encodes pattern, text, flags, and mode.
What are capture groups?
Parentheses () create capture groups. Use $1, $2 in replacements. Non-capturing groups use (?:).

Related Tools