Regex Tester
Test your regular expressions against sample text.
Matches (2)
helloGroup 1: helloworldGroup 1: worldHow to use
Enter your pattern, set any flags you need (like 'g' for global or 'i' for case-insensitive), and type or paste your test text. Matches update live, with each match's index and any capture groups listed below it.
- Enter your regular expression pattern.
- Set any flags you need — for example 'g' for global matching or 'i' for case-insensitive.
- Type or paste your test text — matches update live as you type.
- Review each match's index and any capture groups listed below it.
About Regex Tester
Regex Tester runs a regular expression against sample text and shows every match live as you type, including any capture groups within each match.
Common Regex Patterns
A few patterns come up often enough to be worth having on hand: an email-like string generally matches ^[^\s@]+@[^\s@]+\.[^\s@]+$, a simple word made only of letters matches [a-zA-Z]+, and digits-only matches \d+. These are deliberately simple starting points, not production-grade validators — real-world email and URL formats have edge cases that a short pattern won't fully cover, so treat patterns like these as a first pass to test against representative examples, not a final answer.
Understanding Regex Flags
Flags change how a pattern matches without changing the pattern itself. 'g' (global) finds every match in the text instead of stopping at the first one — the most common source of "why isn't this matching everything" confusion. 'i' (case-insensitive) makes the match ignore letter case. 'm' (multiline) changes how ^ and $ behave, matching the start and end of each line rather than only the start and end of the whole string. Flags can be combined by typing them together, like 'gi'.
Common Use Cases
- Debugging why a regex isn't matching what you expect before using it in code.
- Testing an email, URL, or phone-number pattern against a range of sample inputs.
- Understanding what a capture group in an existing regex actually extracts.
Tips
Frequently Asked Questions
Why is my regex only matching once?
Without the 'g' (global) flag, a regex stops after its first match. Add 'g' to the flags field to find every match in the text instead of just the first.
What do capture groups do?
Parentheses in a pattern create a capture group — a sub-part of the match that gets extracted separately. This tool lists each match's capture groups underneath it, so you can see exactly what each group pulled out.
Is this JavaScript regex or another flavor?
This tool uses JavaScript's native regular expression engine — the same one that runs in browsers and Node.js — so patterns and flags behave exactly as they would in your own JS code, which may differ slightly from other regex flavors like PCRE or POSIX.