TOOL · ON YOUR DEVICE
Regex tester online for free
Type a pattern and some test text and you instantly see what matches, with each capture group in a table. Turn on flags such as g, i, m or s and try a replacement with $1 or $<name>. It uses your browser’s JavaScript regular expression engine, without sending anything.
- Free account to copy
- JavaScript flavour
- Groups and replace
- Type the pattern and the text
- Choose the flags
- Review and replace
HOW TO USE IT
Three steps.
Type the pattern and the text
The pattern goes without slashes, for example \d+ to find numbers. The test text can be up to 200,000 characters.
Choose the flags
g finds every match, i ignores case, m and s change how ^, $ and the dot work. Each flag is explained next to its checkbox.
Review and replace
Matches are highlighted in the text and groups appear in a table. Type a replacement with $1 or $<name> to see the result and copy it.
NEXT STEP
Keep going with these tools
Regex tester: common questions
Which regex flavour does it use?
JavaScript (ECMAScript), with your browser’s engine: it matches what your JavaScript code will do. It can differ from PCRE, Python or Java in details such as possessive quantifiers, \A and \Z or POSIX classes.
Why did the search stop?
If a pattern takes more than 2 seconds, it is stopped so the page does not freeze. This usually comes from catastrophic backtracking, as in (a+)+$: avoid nested quantifiers that match the same thing.
How many matches does it show?
Up to 1,000 highlighted and in the table; if there are more, you see a notice. The replacement applies to the whole text: to every match with the g flag, or only the first without it.
Is my text sent to a server?
No. Everything is calculated in your browser as you type; the text is not sent to Cocuyo or any third party and is not stored. You can check it in your browser’s network tools: your file is not sent.
How does access work?
You can test and view regular expression results without an account. Copying with the button requires a free account. Local use does not consume credits or welcome uses.
How long can the pattern, the replacement and the test text be?
The pattern and the replacement can each have up to 5,000 characters. The test text can have up to 200,000 characters.
What do $1, $<name> and $& do in the replacement?
$1, $2 and so on insert a capture group by its number, and $<name> inserts a named group. $& inserts the whole match, and $$ gives a plain dollar sign. The preview uses the browser’s own replace method, so the result matches what JavaScript produces.
How do I copy the pattern to use it in my code?
Press “Copy as /pattern/flags” to copy the pattern in slash notation with the flags you have ticked. “Copy result” copies the output of the replacement instead.
What does the d flag add to the table?
The d flag adds the start and end position of each capturing group, shown in parentheses after its value. Without the flag, the table shows only the values.
MORE FREE TOOLS
Other text tools
All free tools
WHEN YOU WANT TO CREATE
Make new images with AI.
Cocuyo’s Studio brings 30+ AI models for image, video and voice together. You see the credit cost before generating, and credits never expire.
































































