Tooleux

Develop and debug JavaScript regular expressions with live match highlighting.

Runs in your browser. Nothing leaves your device.
Test JavaScript regular expressions with live highlighting, capture groups, and replace preview. Free, offline. Read more Show less

What is a regex tester?

A regex tester lets you write a regular expression, run it against sample text, and see exactly what matched. It is the fastest way to develop and debug patterns without guessing at the result.

This tool supports every JavaScript regular expression feature: character classes, quantifiers, alternation, lookahead, lookbehind, named groups, unicode property escapes, and the d flag for match indices.

How to use

Type your pattern, choose flags, paste the text you want to test, and see the results update live. Matches are highlighted in the text and listed with their position and capture groups.

Optional: type a replacement string in the Replace field to preview the result of String.replace(). Use $1, $2, or $<name> to reference captured groups.

Flags

g - global: find all matches, not just the first.

i - case insensitive.

m - multiline: ^ and $ match at line breaks.

s - dot all: . matches newlines too.

u - unicode: enables full Unicode matching, including astral characters.

y - sticky: match only from lastIndex, useful for tokenizers.

FAQ

Which regex flavor does this use?

JavaScript (ECMAScript). It is compatible with Node.js, browsers, and any tool that uses the V8 or SpiderMonkey regex engines. PCRE, Python's re, and .NET have some additional features not available here - notably \\A, \\Z, and atomic groups.

Why does my pattern hang the page?

Catastrophic backtracking. Patterns like (a+)+b against a long string of a characters can take exponential time. If the tool becomes unresponsive, press the browser's stop button or reload the page. To avoid it, restructure the pattern to avoid nested quantifiers on the same characters.

What is the difference between a lookahead and a capture group?

A lookahead (?=...) checks what comes next without consuming it. A capture group (...) consumes the matched text and saves it for backreferences or replacement. Lookbehind (?<=...) checks the preceding text.

Can I test across multiple lines?

Yes. Paste multi-line text into the test string. Use the m flag if your pattern uses ^ or $ and you want them to match at every line break.

Command line equivalent
# Node
node -e '
const re = /pattern/gi;
const text = "sample text";
let m;
while ((m = re.exec(text)) !== null) {
  console.log(m.index, m[0], m.slice(1));
}
'

# Python
python3 -c 'import re; print([(m.start(), m.group()) for m in re.finditer(r"pattern", "sample", re.I)])'

# ripgrep
echo "text" | rg --color=always "pattern"

# grep
echo "text" | grep -E --color=always "pattern"
Loads a test value into the form
/ /
Test string
Replace (optional)