Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
Regular expressions are precise but unforgiving — a single misplaced character class or quantifier can silently change what a pattern matches. This tester runs your regular expression against sample text using PHP's PCRE engine (the same engine behind Laravel's own validation rules) and shows every match it finds, exactly where each one starts, and any captured groups within it.
If the pattern itself is invalid — an unclosed bracket, a bad quantifier — you get the actual PCRE compile error instead of a silently empty result, so you know immediately whether the problem is the pattern or just that nothing in your text matches.
How it works
Enter your pattern (without the surrounding delimiters — just the regex itself, e.g. \d+ rather than /\d+/), the text to test it against, and any flags you need (i for case-insensitive, m for multiline, s for dotall, u for Unicode). Every match is shown with its position in the string and any captured groups, updated as soon as you run the test.
- Enter your pattern (without delimiters, e.g. \d+).
- Enter the text to test it against and any flags you need.
- Review every match, its position and captured groups.
Examples
Matching numbers in text
The pattern `\d+` against "I have 12 apples and 34 oranges" finds two matches: "12" at position 7 and "34" at position 21.
Extracting an email address with groups
The pattern `(\w+)@(\w+\.\w+)` against "contact jane@example.com for details" matches "jane@example.com" and captures two groups: "jane" and "example.com" — useful for pulling structured pieces out of a larger match.
Who should use it
- Debugging why a regex isn't matching what you expect before using it in real code.
- Extracting structured data (emails, IDs, dates) from sample text using capture groups.
- Verifying a validation pattern against a range of valid and invalid example inputs.
- Learning regex syntax by experimenting against real text interactively.
Industry applications
- Software development and debugging
- Data extraction and text processing
- Log file analysis
- Form validation design
Advantages
- Shows every match's exact position in the text, not just whether a match occurred.
- Displays captured groups for each match, useful for extraction patterns.
- Surfaces the actual PCRE compile error for invalid patterns instead of a generic failure.
Limitations
- PCRE (PHP/Perl-style) syntax only — doesn't emulate other regex flavors (JavaScript, Python's re module have minor syntax differences).
- Caps the number of displayed matches for very large inputs with extremely high match counts.
- No visual pattern-explanation/breakdown — it shows results, not an annotated diagram of the pattern itself.
Common mistakes to avoid
- Including delimiter slashes in the pattern field, which this tool doesn't expect (it adds its own internally).
- Forgetting to escape special regex characters (like `.` or `(`) when they're meant to be matched literally.
- Using greedy quantifiers (`.*`) when a non-greedy one (`.*?`) is what actually matches the intended, narrower text.
- Forgetting the `u` flag when testing a pattern against text containing multi-byte Unicode characters.
Best practices
- Test a pattern against several example strings, including ones it should NOT match, not just the one case you have in mind.
- Use named or numbered capturing groups deliberately when you need to extract specific pieces of a match, not just confirm a match happened.
- Keep patterns as specific as reasonably possible — an overly broad pattern can match more than intended in real-world text.
Tips
- If a pattern doesn't match at all, first check it's valid (no error shown), then check the `i`/`s`/`m` flags match the case-sensitivity and structure of your actual text.
- When extracting data, design the pattern around capture groups from the start rather than parsing the full match string afterward.