Regex Tester

Validate pattern, flags, and target text on one screen, then inspect match positions and extracted results immediately. No input is sent to a server.

Status

Runs in your browser. No input is sent to a server.

How to use

Enter pattern, flags, and target text, then click Test. After reviewing matches, enter replacement text and click Replace.

Notes (this tool)

  • Supported flags follow common JavaScript set: `dgimsuy`.
  • Do not include surrounding slashes (`abc`, not `/abc/`).

About this page

What does this tool do?

Test JavaScript (ECMAScript) regular expressions in your browser and inspect match count, match index, and captured groups.

You can also preview replacement results on the same screen, useful for log cleanup and drafting validation rules.

What this tool does

  • Check whether the regex compiles
  • Show match count and match positions
  • Show capture-group values
  • Generate replaced text

Recommended workflow

  • Enter your pattern and run Test first
  • Check match index and capture values
  • Enter replacement text and run Replace
  • Copy the result and apply it in your implementation

Notes

  • This tool uses JavaScript regex. Behavior differs from PCRE (PHP) or RE2 (Go).
  • Newline, Unicode, and lookaround behavior may vary by runtime version.

Referenced specs

  • ECMAScript Language Specification (RegExp)
  • MDN: Regular expressions

FAQ

Why do results differ from my server-side regex?

Different regex engines behave differently. JavaScript, PHP, Go, and Java do not always interpret patterns the same way.

When do I need the g flag?

Use it when you need multiple matches across the full text. Without g, you usually get only the first match.

References

  1. ECMAScript RegExp
  2. MDN Regular Expressions

These links are generated from site_map rules in recommended diagnostic order.

  1. Regex Cheat Generator — Generate regex patterns from practical templates
  2. Text Counter — Count characters including newline and full/half-width views
  3. .env Diff Checker — Compare .env added/removed/changed keys
  4. UTM Builder — Build URLs with UTM parameters
  5. Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
  6. Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
  7. Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways
  8. Cron Builder — Build 5-field cron and preview upcoming runs

Quick Calculators

One-screen calculators for commonly forgotten quick math