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
Next to view (diagnostic order)
These links are generated from site_map rules in recommended diagnostic order.
- Regex Cheat Generator — Generate regex patterns from practical templates
- Text Counter — Count characters including newline and full/half-width views
- .env Diff Checker — Compare .env added/removed/changed keys
- UTM Builder — Build URLs with UTM parameters
- Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
- Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
- Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways
- Cron Builder — Build 5-field cron and preview upcoming runs
Same-theme links
Quick Calculators
One-screen calculators for commonly forgotten quick math
- Mahjong Point Calculator — Calculate point movement on win from han/fu, honba, and kyotaku
- Mahjong All-Last Calculator — Compute ron/tsumo conditions needed to reach target rank from current scores
- Unix Time Converter — Convert Unix seconds/milliseconds and date-time both ways
- Cron Builder — Build 5-field cron and preview upcoming runs
- Text Counter — Count characters including newline and full/half-width views
- Regex Cheat Generator — Generate regex patterns from practical templates
- SQL WHERE Builder — Build WHERE clauses and bind params from condition rows
- SQL UPSERT Builder — Generate dialect-specific UPSERT SQL and bind values
- Random Token Generator — Generate random tokens with selectable byte size and encoding