Code tool
Regex Tester
Write a pattern, paste some text, and see every match, capture group and replacement as you type.
Runs entirely in your browser. Nothing you paste is uploaded.
Result after replacing
| # | Index | Match | Groups |
|---|
How to use the Regex Tester
- Type your pattern without the surrounding slashes and tick the flags you need.
- Paste the text you want to test. Matches are highlighted and listed with their position and groups.
- Optionally add a replacement to preview the result, then copy the finished /pattern/flags.
How this regex tester behaves
A regex tester checks a regular expression against sample text and shows what it matches. This online regex tester uses the JavaScript engine in your browser and highlights every match and capture group as you type.
The tester uses your browser’s own JavaScript regular expression engine, so what matches here is exactly what will match in JavaScript, TypeScript and Node.js code. Named groups such as (?<year>\d{4}), lookbehind and Unicode escapes are supported wherever your browser supports them.
Matching runs in the background. If a pattern backtracks without end, a common result of nested quantifiers like (a+)+, it is stopped after 1.5 seconds and reported, instead of freezing the tab.
Remember the g flag: without it a pattern only finds its first match. Other languages share most of this syntax, but details such as lookbehind and possessive quantifiers differ in PHP, Python and Go.
Common questions
How do I test a regular expression online?
Enter the pattern and its flags, then paste the text to search. Matches are highlighted and each capture group is listed.
Which regex flavour does this use?
JavaScript (ECMAScript). It is the flavour used by browsers and Node.js.
Why do I only get one match?
The g (global) flag is off. Without it, a JavaScript regex stops after the first match.
What do $1 and $<name> mean in the replacement?
$1 inserts the text captured by the first group, and $<name> inserts a named group. $& inserts the whole match.
Is my text sent anywhere?
No. The pattern and the test text stay in your browser.
Guides for the Regex Tester
- How to Test Regular Expressions: A Practical Regex GuideTest regular expressions with live matches, capture groups and replacements. The core regex syntax, common mistakes and patterns you can reuse.
- Regex Cheat Sheet: The Patterns You Will Use MostA regex cheat sheet with the syntax you need and ready-made patterns for emails, URLs, phone numbers, dates, slugs and hex colours, each explained.
- Cron Expressions Explained: Syntax, Examples and Common MistakesA cron expression has five fields: minute, hour, day of month, month and day of week. Syntax, ready-made examples and the mistakes to avoid.
- UUID v4 vs v7: Which to Use and How to Generate ThemUUID v4 is random and UUID v7 is time-ordered. See how they differ, which is better for database keys, and how to generate either one in bulk.