Regex Tester
Test a pattern against sample text, add flags, and review each match with its index.
Test regular expressions directly in your browser. Enter a regex pattern, optional flags, and sample text to see matches instantly.
Input Text
Paste sample text to test
Results
Matched values
How it works
This regex tester builds a JavaScript regular expression from your pattern and flags, then runs it against the input text to show matches.
It is useful for testing validation patterns, extracting values, debugging text processing logic, and checking whether a regex behaves as expected before using it in code.
Common use cases
- Test email or phone number patterns
- Extract IDs, tokens, or numeric values
- Check JavaScript regex behavior quickly
- Debug matching rules before coding
- Validate text parsing logic in the browser
Frequently asked questions
What does this regex tester do?
It lets you test regex patterns against sample text and view matches directly in your browser.
Can I use regex flags like g, i, and m?
Yes. You can enter common JavaScript regex flags such as g, i, and m.
Does this tool validate invalid regex patterns?
Yes. Invalid patterns show an error message instead of running the test.
Related tools
How to use
Enter the pattern and flags, paste sample text, then inspect the matches.
- Type the regex pattern you want to test and add any optional flags.
- Paste the sample text you want to search.
- Click Test Regex to review each match, its index, and any errors.
Use cases
Use it when you want to prove a pattern works before you move it into code.
- Test validation patterns against real sample strings.
- Inspect matches from logs, exports, or copied text blocks.
- Compare how different flags change the result before you ship a regex.
Example
A quick example of how this tool works.
Input
Pattern: \\d+\nText: Order 123 shipped on 2026-03-07
Output
Matches: 123, 2026, 03, 07