Runs on your device. Nothing is uploaded. Zero ads, unlimited use.
What is Regex Tester?
The Regex Tester lets you build and check regular expressions against your own text. Every match is highlighted live as you type, and a list shows each match with its position, capture groups and named groups.
It is made for developers, data analysts, testers and anyone cleaning text in an editor or spreadsheet. A library of common patterns, such as email, URL, phone numbers and dates, gives you a working start.
Matching uses the JavaScript regex engine in your browser and runs in the background with a time limit, so a pattern that would take forever is stopped instead of freezing the page. Your text never leaves your device.
What you can use it for
Validating input
Check that an email, postcode or phone pattern accepts the right values and rejects the wrong ones before it goes into a form.
Extracting data
Pull dates, amounts, IDs or links out of logs, emails and exported text.
Search and replace
Preview a replacement like turning 2026-01-15 into 15/01/2026 before running it in your code or editor.
Learning regex
Try patterns from the library and see what each part matches.
Debugging slow patterns
Find out if a pattern backtracks badly on long text without hanging your browser.
Step-by-step tutorial: how to use Regex Tester
Enter a pattern
Type the regular expression between the slashes, without the slashes themselves. If you paste a full literal like /abc/gi, the tool splits it into pattern and flags for you.
Or pick a common pattern
Choose one from Common patterns. It fills in the pattern, the right flags and an example text if your text box is empty.
Set the flags
g finds all matches, i ignores case, m makes ^ and $ work per line, s lets . match line breaks, u enables Unicode features like \p{L}, y is sticky and d records group positions.
Add test text
Paste your text into Test text. Matches are highlighted in alternating colours; empty matches show as a thin orange marker.
Read the match details
Each match shows its text, start and end index and length, followed by every capture group. Named groups show their name, and with the d flag the position of each group is shown too.
Preview a replacement
Type into Replace with using $1, $2, $<name>, $& for the whole match and $$ for a dollar sign. The replaced text appears below.
Copy your work
Copy regex copies a ready-to-use JavaScript literal like /\d+/g; Copy replaced text copies the result.
Features
- Live highlightingMatches update as you type, with safe escaping so any text, including HTML, shows exactly as written.
- Groups and named groupsSee each capture group's value and, with the d flag, its exact position.
- Replace previewSupports $1, $<name>, $& and $$, exactly like JavaScript's replace.
- Pattern libraryEmail, URL, phone, dates, time, IPv4, hex colour, UUID, postcodes, hashtags, emoji and more.
- Clear error messagesInvalid patterns explain the problem, such as an unterminated group.
- Freeze protectionMatching runs in a Web Worker and is stopped after 2 seconds, so catastrophic backtracking cannot lock up the page.
- PrivateYour pattern and text stay in your browser.
Worked example: reformatting dates
Your text says: Invoices 2026-01-15 and 2026-12-31. Choose "Date YYYY-MM-DD (named groups)" from Common patterns. Two matches are highlighted. Match 1 shows Group 1 <year> 2026, Group 2 <month> 01 and Group 3 <day> 15. Type $<day>/$<month>/$<year> into Replace with, and the preview reads: Invoices 15/01/2026 and 31/12/2026. Click Copy replaced text to use it.
Tips and tricks
- Remember to tick g if you want every match; without it JavaScript stops at the first one.
- Escape special characters such as . * + ? ( ) [ ] { } | \ with a backslash when you mean them literally.
- Use \b for word boundaries so cat does not match inside category.
- Avoid nested repeats like (a+)+ or (.*)*; they are the usual cause of very slow patterns.
- Tick u to use Unicode properties like \p{L} for letters in any language.
Problems and how to fix them
It says Invalid pattern
Read the message: usually a bracket or parenthesis is not closed, or a special character needs a backslash.
The pattern was stopped for taking too long
It backtracks heavily on your text. Make repeats more specific, for example [^,]* instead of .*, and remove nested quantifiers.
My pattern works elsewhere but not here
Other languages have slightly different regex features. This tester follows JavaScript; for example, possessive quantifiers and some lookbehind forms are not available in every engine.
Only one match appears
Tick the g (global) flag to find all matches.
Questions and answers
Which regex flavour does this use?
JavaScript (ECMAScript), the same engine your browser uses. Most patterns also work in other languages, but features like lookbehind or named groups can differ.
Why does it say my pattern took too long?
Some patterns, such as (a+)+ on a long text, can take an extremely long time. The tester runs each pattern in the background and stops it after 2 seconds so the page never freezes.
How do I use groups in the replacement?
Use $1, $2 and so on for numbered groups, $<name> for named groups, $& for the whole match and $$ for a dollar sign.
Why is only one match found?
Without the g (global) flag JavaScript stops at the first match. Tick g to find all of them.
Is my text sent anywhere?
No. The pattern and text never leave your browser.