Regex Tester
About this tool
Editing a regex in source and redeploying is slow. Drop the pattern next to sample text, toggle flags, and see what actually matches. Starter patterns are drafts; tighten anchors for your product rules.
Features
- Live match highlighting on sample text
- Independent g, i, m, s, and u flags
- Starter patterns that you must still adapt
How to use
- Enter the pattern and paste realistic samples.
- Toggle flags such as global or ignore-case.
- Tighten anchors or quantifiers from the highlights.
- Re-test empty, long, and multiline cases before pasting into code.
When to use it
- A form regex never matches the strings QA provided
- Extracting order IDs from log lines
- Forgetting g so only the first match is replaced
Examples
- \d{11} highlights eleven digits in “phone 13800138000”.
- Without g, /error/ highlights only the first error.
FAQ
Same as Java or Python regex?
This page uses JavaScript. Lookbehind and Unicode classes can differ—re-test in production language.
How do I match a phone number?
There is no universal pattern. Start from a template, then decide on country codes, spaces, and extensions.
What does the g flag do?
Global: find every match. Off, you typically only see the first, similar to a single replace.
Are there starter patterns?
Yes. Treat them as drafts, not payment-grade or ID-card validators.
Is sample text uploaded?
No. Matching stays in the browser.
The tab hangs on a pattern?
Likely catastrophic backtracking. Shorten the sample and avoid nested quantifiers.
Back to Text Tools Hub
Guides