Regex tester
Write a regular expression and see what it matches, as you type.
Type the pattern without the slashes, or paste a whole /pattern/flags.
Paste text, open a file, or drop one here
Cheat sheet
- \d
- A digit, 0–9
- \w
- A letter, digit or underscore
- \s
- A space, tab or line break
- .
- Any character except a line break
- ^
- Start of the text (or line, with m)
- $
- End of the text (or line, with m)
- *
- The thing before, 0 or more times
- +
- The thing before, 1 or more times
- ?
- The thing before, optional
- {n,m}
- The thing before, between n and m times
- [abc]
- Any one of a, b or c
- (…)
- A group, captured as $1, $2, …
- (?<name>…)
- A named group, captured as $<name>
- a|b
- Either the left side or the right side
Next: Diff checker · JSON formatter
Report a problem with this tool
How to use Regex tester
Type your pattern
Enter the regular expression without the slashes, or paste a whole /pattern/flags, and tick the flags you need.
Add some test text
Paste text or open a file. Every match is highlighted, with its position and groups listed below.
Replace or copy
Tick Replace to try a replacement with $1 or $<name>, then copy the result or the regex itself.
Why use Utils365
Groups at a glance
Each match shows its numbered and named groups, so you can check what $1 or $<year> will hold.
Safe from runaway patterns
Matching runs in the background with a one-second limit, so a pattern that backtracks forever can’t freeze the page.
The same engine as your code
It uses your browser’s JavaScript regex engine, so results match what Node.js and the browser will do.
Private by design
Your pattern and text stay in your browser. Nothing is uploaded, so log files and customer data are safe to test.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript), the same as browsers and Node.js. Most patterns work the same in other languages, but lookbehind, named groups and some escapes differ in older engines.
What do the g, i, m, s, u and y flags do?
g finds all matches, i ignores case, m makes ^ and $ match at each line, s lets . match line breaks, u turns on full Unicode support and y makes each match start where the last one ended.
How do I use a capture group in the replacement?
Write $1, $2 and so on for numbered groups, $<name> for named groups, and $& for the whole match. To insert a real dollar sign, write $$.
Why does my pattern say it took too long?
Some patterns, such as (a+)+ against a long string, try an enormous number of ways to match before giving up. This is called catastrophic backtracking. Make nested repeats more specific to fix it.
Why do I only see one match?
Without the g flag a regular expression stops at the first match. Tick Global (g) to find them all.
How do I match a literal dot or bracket?
Put a backslash before it: \. matches a dot and \[ matches a bracket. The same goes for other special characters like * + ? ( ) { } | ^ and $.