Developer
Regex Tester
Enter a pattern and the matches appear here, highlighted in your text.
Write a regular expression, paste some text, and see every match highlighted with its position and capture groups. Try a replacement and copy the pattern as code.
How to use this tool
Enter a Regular expression, choose the flags you need (Global, Ignore case, Multiline, Dot matches newline, Unicode), and paste the Text to test. Email addresses, URLs, Dates, Hex colors, IPv4 addresses and Words in quotes fill in a ready-made pattern.
Matches are highlighted with their positions, and each match lists its capture groups. Turn on Replace matches to preview a replacement, using $1, $<name>, $& or $$.
Refine the pattern until it matches what you want, then Copy regex as a JavaScript literal or constructor call, or copy the replaced text. A pattern that takes too long is stopped with a warning.
How to use this tool
Enter a Regular expression, choose the flags you need (Global, Ignore case, Multiline, Dot matches newline, Unicode), and paste the Text to test. Email addresses, URLs, Dates, Hex colors, IPv4 addresses and Words in quotes fill in a ready-made pattern.
Matches are highlighted with their positions, and each match lists its capture groups. Turn on Replace matches to preview a replacement, using $1, $<name>, $& or $$.
Refine the pattern until it matches what you want, then Copy regex as a JavaScript literal or constructor call, or copy the replaced text. A pattern that takes too long is stopped with a warning.
Was this tool helpful?
Suggest an improvementHelp keep ConduitTools free
Every tool here is free, private and built by a solo developer. If this one saved you time, a small tip keeps the site running and new tools coming.
See exactly what your pattern does.
A regular expression is easy to get almost right. Seeing each match, and each group inside it, shows where a pattern is too greedy or too strict.
- Live highlighting
- Every match is marked in your text as you type, with its position, line and column listed underneath. Neighbouring matches alternate colors so you can tell where one ends.
- Groups and replacement
- Capture groups and named groups are listed for each match. Turn on replace to preview the result with $1, $<name> and $& before you use it in code.
- Safe against runaway patterns
- Matching runs in the background and is stopped after a moment, so a pattern with catastrophic backtracking gives you a warning instead of freezing the tab.
Frequently asked questions
Which regex flavor does this use?
JavaScript's, the same engine your browser and Node.js use. Most syntax is shared with other languages, but a few things differ: named groups are written (?<name>...) rather than (?P<name>...), and there are no possessive quantifiers or atomic groups.
What do the flags do?
Global finds every match instead of just the first. Ignore case treats upper and lower case as equal. Multiline makes ^ and $ match at each line. Dot matches newline lets . cross line breaks. Unicode turns on full Unicode handling, including \u{1F600} escapes.
Why does it say my pattern is taking too long?
Some patterns, such as (a+)+$ on a long run of a's, make the engine try an exponential number of paths. That is called catastrophic backtracking. Make the pattern more specific, or avoid repeating a group that can already match the same text in several ways.
How do I use a group in the replacement?
Write $1, $2 and so on for numbered groups, $<name> for a named group, and $& for the whole match. Use $$ for a literal dollar sign.
