Regex Tester

Test and debug regular expressions with live match highlighting.

Regex Pattern

/ /

Results

About the Regex Tester

The Regex Tester runs a regular expression against your sample text and highlights what it matches, live as you type. Add flags for case-insensitive, global or multiline matching, and optionally a replacement string to see the substituted result.

Regular expressions describe a pattern rather than a literal string, which is what makes them powerful and unreadable in equal measure. \d is a digit, \w a word character, \s whitespace, and the quantifiers * + ? and {n,m} say how many times the previous thing may repeat.

Two practical warnings. Special characters such as . * + ? ( ) [ ] need escaping with a backslash when you mean them literally. And some patterns, particularly nested quantifiers like (a+)+, can backtrack catastrophically and hang on certain inputs, so avoid them on untrusted text.

Common questions about Regex Tester

What do the flags do?

g finds all matches rather than the first, i ignores case, and m makes ^ and $ match the start and end of each line.

Why does my pattern match nothing?

Usually an unescaped special character. A literal dot needs \. and a literal bracket needs \[.

Can I test a replacement?

Yes. Enter the replacement string and the tool shows the substituted output, with $1 referring to the first capture group.

Does it support lookbehind?

Modern browsers support (?<=...) and (?

What is catastrophic backtracking?

A pattern that explores exponentially many ways to fail, freezing the browser. Nested quantifiers are the usual cause.

Is my text uploaded?

No. Matching happens in the browser.

Related Tools in Developer Tools

JSON FormatterBase64 Encoder/DecoderURL Encoder/Decoder