Regex Tester & Debugger
Test and debug regular expressions in real time. Type your pattern and test string to instantly see highlighted matches and captured groups.
About This Tool
Regular expressions (regex) are powerful patterns used to match character combinations in strings. They are fundamental to text processing, data validation, search and replace operations, and parsing structured text. This regex tester online lets you test JavaScript-flavored regular expressions in real time — as you type, matches are highlighted immediately.
Regular expressions can be tricky to get right. A small mistake in the pattern can lead to unexpected matches or no matches at all. This tester eliminates the guess-work by giving you instant visual feedback: matched portions of your test string are highlighted in yellow, the total match count is shown as a badge, and captured groups are displayed in a table below.
The tool supports all standard JavaScript regex flags: g (find all matches, not just the first), i (case-insensitive matching), and m (multiline mode where ^ and $ match line boundaries). If your pattern is invalid, a clear error message explains the syntax problem.
How to Use
- Enter your regular expression pattern in the Pattern field (without the surrounding slashes).
- Check or uncheck the flags you need: g for global, i for case-insensitive, m for multiline.
- Paste your test string into the Test String area.
- Matches are highlighted automatically as you type — no button press needed.
- The match count badge shows how many matches were found.
- If your pattern contains capturing groups
(...), the captured values are shown in the table below.
Regex Quick Reference
.— any character except newline\d— digit (0–9),\w— word char,\s— whitespace*— 0 or more,+— 1 or more,?— 0 or 1{n,m}— between n and m repetitions^— start of string,$— end of string[abc]— character class,[^abc]— negated class(abc)— capturing group,(?:abc)— non-capturing group
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used to find, match, and manipulate text. Regex is supported in virtually every programming language and is essential for tasks like input validation, text parsing, and search-and-replace operations.
What do the regex flags g, i, and m mean?
The g (global) flag finds all matches instead of stopping at the first. The i (case-insensitive) flag makes the match ignore uppercase and lowercase differences. The m (multiline) flag makes ^ and $ match the start and end of each line rather than the entire string.
How do I test a regex pattern online?
Enter your pattern in the Pattern field (without surrounding slashes), select any flags you need, then paste your test string. Matches are highlighted in real time as you type — no button press required.
What are capturing groups in regex?
Capturing groups are portions of a regex pattern wrapped in parentheses, e.g. (\d+). They capture the matched text so it can be extracted or referenced separately. This tool displays all captured group values in a table below the test string when matches are found.
Why does my regex not match anything?
Common reasons: missing the g flag (only first match found), wrong escaping (use \. for a literal dot, not just .), or character class issues. Check the error message — if your pattern is invalid, a clear explanation is shown.