Skip to main content
ConduitTools by ConduitCode Labs

Developer

Regex Tester

Waiting for a pattern
Pattern and textWrite an expression, then paste the text to test it on
Start from an example
MatchesHighlighted as you type, with every group

Enter a pattern and the matches appear here, highlighted in your text.

—Matches
—Capture groups
—Flags
—Match time

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.

  • Free
  • No sign-up
  • Runs in your browser

How to use this tool

  1. 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.

  2. 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 $$.

  3. 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
  1. 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.

  2. 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 $$.

  3. 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 improvement

Help 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.

What it handles

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.

Keyboard shortcuts

Press navigation keys one after the other. Single-key shortcuts work outside text fields.

Ctrl+K
Search all tools
/
Focus directory search, or search all tools on other pages
GthenH
Go to the homepage
GthenT
Browse all tools
GthenF
Open FAQs
Ctrl+Enter
Copy or download the result
Ctrl+Shift+Enter
Generate a new password or new text
?
Show this list
Esc
Close a dialog or menu
↑↓
Move through tool search results
Enter
Open the selected search result