Test regular expressions with live highlighting, capture groups and a plain-English explanation of your pattern.
Type a regular expression or pick an example.
g all matches · i ignore case · m ^ $ per line · s dot matches line breaks · u UnicodeMatches are highlighted as you type.
Preview a find-and-replace. Use $1, $2 or $<name> for groups.
Highlighted in your text, with positions and groups.
What each part does, in order.
Click a snippet to insert it into your pattern.
i to ignore case — and read the plain-English explanation of your pattern.A regular expression (regex) is a pattern that describes text. It can find every phone number in a document, check that an input looks like an email, or replace dates from one format to another. \d{10}, for example, means “ten digits in a row”.
This tester uses JavaScript regular expressions, the flavour used in browsers and Node.js. Most basics are the same in other languages, but some features (such as lookbehind, named groups or flags) differ, so check your language’s documentation before copying a pattern.
Every match is highlighted in your text, with alternating colours so neighbouring matches are easy to tell apart. The table lists each match with its position (index, counting from 0) and the text captured by each group: $1, $2 and so on, or the group’s name. The explanation panel breaks your pattern into parts in the order they appear.
Some patterns, such as (a+)+$ on a long string of a’s, can take a very long time because the engine tries a huge number of combinations (“catastrophic backtracking”). The tester runs your pattern in the background and stops it after a short time, so your browser never freezes.
Enter your pattern in the pattern box and some sample text below it. Matches are highlighted immediately, and you can adjust the pattern or flags until it matches what you expect.
g finds all matches instead of just the first. i ignores upper/lower case. m makes ^ and $ match at the start and end of each line. s lets the dot match line breaks. u turns on full Unicode support.
Use the examples above the pattern box: they include a 10-digit number, Indian mobile numbers, email addresses, PAN, PIN codes and IFSC codes. Click one, then adjust it for your data. Remember that format checks only confirm the shape, not that a number or address really exists.
Brackets around part of a pattern, such as (\d{2})/(\d{2}), capture the text they match so you can reuse it. They appear as $1, $2 in the results table and can be used in the replacement, e.g. $2/$1 swaps the two parts.
Quantifiers like .* are greedy and match as much as they can. Adding a question mark (.*?) makes them lazy so they match as little as possible, which is handy for text between tags or quotes.
The message comes straight from your browser’s regex engine. Common causes are an unclosed bracket or parenthesis, a quantifier with nothing before it, or a feature your browser doesn’t support, such as lookbehind in older Safari.
No. Everything runs in your browser, so the patterns and text you test stay on your device.
Yes, it is free and has no sign-up or usage limits.