Regex Tester
Test and debug regular expressions online. Real-time pattern matching with syntax highlighting, match groups, and common regex library
Regular Expression Tester
About Regex Tester
Type a regular expression and some test text, and this tool highlights every match as you type. Below the text it lists each match with its position and the contents of every capture group, and you can test a replacement string to see the result. Flags for global (g), case-insensitive (i), multiline (m), dot-all (s) and Unicode (u) matching can be switched on and off.
It uses JavaScript regular expressions (ECMAScript). They are close to the ones in other languages but not identical: for example, features such as possessive quantifiers and atomic groups are not available, and the syntax for named groups and lookbehind can differ from PCRE, Python or Java. If you will use the pattern in another language, test it there as well.
A library of common patterns is built in, such as email addresses, URLs, IPv4 addresses, dates, hex colours and hashtags. They are starting points, not perfect validators; an email regex, for instance, cannot prove an address exists. Be careful with patterns that have nested repeating groups, because they can take extremely long on some inputs (catastrophic backtracking) and freeze the page. Everything runs in your browser.
Who uses it and when
Building a pattern
Try a regex against sample text and see every match highlighted.
Capture groups
Check what each group captures.
Find and replace
Test a replacement before you use it in code.
Learning regex
Start from a common pattern and change it.
Why use this Regex Tester
Test JavaScript regular expressions with live highlighting.
Live highlighting
Matches are marked in your text as you type.
Match and group details
Each match, its index and its capture groups.
Replace test
Preview the result of a replacement.
How it works
Enter the pattern
Type it without the slashes, and set the flags.
Add test text
Paste the text you want to match.
Read the matches
Check highlights, positions and groups.
Frequently asked questions
Which regex flavour is this?
JavaScript (ECMAScript). Other languages may differ in advanced features.
Why did the page freeze?
Some patterns with nested repeats can take extremely long on certain text (catastrophic backtracking). Simplify the pattern.
Do the built-in patterns validate perfectly?
No. They are practical starting points, not strict validators.
Is my text uploaded?
No. Matching runs in your browser.