Free online tool
Test a regular expression against text
Enter a pattern and sample text to inspect matches and captured groups. The browser's regular-expression engine runs the test locally.
Quick answer
Quick answer
Enter a regular-expression pattern and sample text to see matches and captured groups instantly, using the JavaScript engine built into your browser. Common building blocks include backslash-d for digits, backslash-w for word characters and backslash-s for whitespace, with anchors for the start and end of a line. The g flag finds all matches instead of stopping after the first one.
Open the interactive Regex Tester / Matcher
The interactive tool loads in the page. Enable JavaScript to enter data, process content, and download results.
About this tool
About the Regex Tester / Matcher
Enter a pattern and sample text to inspect matches and captured groups. The browser's regular-expression engine runs the test locally.
Detailed guide
How to get useful results from Regex Tester / Matcher
Test regular expressions in real time
Regular expressions are powerful patterns used to search, validate, extract, and replace text. Developers use them to validate email formats, parse log files, extract IDs from URLs, clean data in spreadsheets, and build search features. Because regex syntax is compact, a small mistake can match too much or nothing at all. This free online regex tester lets you enter a pattern and sample text, then view matches and captured groups instantly. It uses the JavaScript regular expression engine built into your browser, so you can test patterns for web apps, Node.js, and many editors locally and privately.
Understanding patterns, flags, and groups
Common building blocks include \d for digits, \w for word characters, \s for whitespace, a dot for any character, and quantifiers such as *, +, ?, and {2,4}. Anchors like ^ and $ match the start and end of a line or string. Parentheses create capture groups that extract specific parts of a match, while named groups make results easier to read. Flags change behavior: g finds all matches, i ignores case, m treats each line separately for anchors, and u enables full Unicode support for international text.
Debugging and portability tips
If a pattern fails to compile, check for unbalanced parentheses or brackets and escape special characters such as dots, plus signs, and question marks when you mean them literally. Build complex patterns step by step and test them against both matching and non-matching examples. Be careful with greedy quantifiers that consume more text than expected, and prefer lazy quantifiers like .*? where appropriate. Regex flavors differ between JavaScript, Python, PHP, Java, and .NET, so features such as lookbehind or possessive quantifiers may behave differently in other languages.
Regular expressions are useful well beyond programming. Data analysts use them in spreadsheets and SQL databases, writers use them for advanced find-and-replace in editors, and SEO specialists use them to filter URLs in analytics and search console reports. Testing patterns first helps avoid accidental changes across large documents or datasets.
Quick guide
How to use this tool
- 01Enter a pattern and any supported flags.
- 02Paste the text to test.
- 03Review matches, captures, or a readable pattern error.
Capabilities
Features and supported formats
- Shows matches and capture groups.
- Supports JavaScript regular-expression syntax.
- Runs locally against the text you provide.
Supported formats
Input: JavaScript regular-expression pattern and plain text.
Answers
Frequently asked questions
Which regex syntax is supported?
The tester uses the JavaScript RegExp engine, so syntax and flags follow the browser's JavaScript implementation.
Why does a pattern fail to compile?
The pattern may contain an unmatched bracket or parenthesis, an invalid escape, or a flag unsupported by the browser. Review the displayed syntax message.
Can I test regex for Python or PHP here?
Many basic patterns work across languages, but this tester uses JavaScript syntax. Check language-specific features in your target environment.
What does the g flag do?
The global flag finds all matches in the text instead of stopping after the first match.
How do I test a regex for email validation?
A practical email pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$, which checks for text, an @ sign, a domain, and a dot. Paste the pattern and several sample addresses into the tester, including invalid ones like missing @ signs, to confirm it accepts real addresses and rejects bad ones.
What is the difference between a regex match and a capture group?
A match is the full portion of text the pattern finds. Capture groups, written in parentheses, pull out specific parts of that match, such as the area code from a phone number. The tester shows both the full match and each group's contents so you can verify extraction logic.