Regex Tester
Test regular expressions against sample text.
About this tool
Enter a pattern and flags, paste your test text, and see every match listed one per line. It uses the JavaScript RegExp engine in your browser. Patterns that backtrack forever are stopped after two seconds instead of freezing the page.
How to use
How it works
The pattern is compiled with new RegExp(pattern, flags) in a background worker, with g always added, and run over the text with matchAll. Each full match is printed on its own line, up to 10,000 matches. If nothing matches the output reads No matches. An invalid pattern shows the engine's error message.
Worked example
Numbers in a sentence
- Input
- Pattern: \d+ Text: Order 1042 shipped; order 77 pending; ref A-9
- Output
- 1042 77 9
- Walkthrough
- \d+ matches each run of digits. The 9 in A-9 is matched too.
Limitations
- Only the full text of each match is shown. Capture groups, indexes and named groups are not displayed.
- No replace or highlight view.
- It follows JavaScript syntax; PCRE or Python-only features such as possessive quantifiers and inline flags may not work.
- Stops after 2 seconds and at 10,000 matches.
Questions
How do I test a regex online?
Which regex flavour does it use?
Why do I see 'taking too long'?
Does it show capture groups?
How do I make it case-insensitive?
Features
- JavaScript RegExp
- Flags field
- 2-second safety timeout
- Runs in your browser
Guides
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Inspect Network Activity - Chrome DevTools 101
Chrome for Developers
Debugging payloads you paste into JSON and JWT tools.
Watch on YouTubeLearn Regular Expressions In 20 Minutes
Web Dev Simplified
Fast path through groups, quantifiers, and character classes.
Watch on YouTube
- Introduction to JSON Web Tokens
jwt.io
JWT structure for decoder and debugger pages.
- Introducing JSON
json.org
Canonical JSON grammar for formatters and validators.