Debugging a Regex That Works in Your Head
By toolbelt maintainers ·
Updated
The pattern matches what you expect on one input and silently fails on another. Seeing the captures is how you find out why.
What is this tool?
A regex tester runs a pattern against sample text and shows every match with its capture groups. That visibility is most of the debugging.
How it works
Patterns run in the browser's own regex engine, so behaviour matches JavaScript exactly, including its quirks. Matches are highlighted in place and named groups are listed separately.
Example
Pattern: (?<user>[\w.]+)@(?<host>\w+)\.\w+ Text: ada@example.com, grace@test.io user: ada host: example user: grace host: test
When to use it
Whenever you are about to commit a regex. Whenever an existing one fails on a specific string and you cannot see why.
Optimization Tips
The bug is usually greed, not syntax. `\w+` will happily swallow more than you meant; `\w+?` will not. And test with the empty string — a surprising number of patterns crash on it.
Frequently Asked Questions
Which flavour is this?
Why does my pattern hang?
Can I replace?
Do I need to escape slashes?
Related tools
- UUID GeneratorGenerate cryptographically secure Version 4 (v4) UUIDs. Create batches of up to 100 unique identifiers at once, perfect for database primary keys or test data.
- Cron GeneratorExplain cron expressions in plain English and predict the next 5 run times. Validate syntax for Linux crontab or serverless schedulers before deploying jobs.
- Timestamp ConverterConvert Unix timestamps to human-readable dates and vice versa. Includes a live clock and automatically handles seconds or milliseconds for easy debugging.
- Timestamp BatchConvert a whole list of Unix timestamps or dates at once. The unit is detected per line, so mixed seconds and milliseconds are handled together.