Regex Tester

//
Hello World, this is a Test of the Regex Tester.

About the Regex Tester

Regular expressions are powerful but notoriously easy to get subtly wrong — an extra character class, a missing anchor, or the wrong flag can make a pattern match too much, too little, or nothing at all.

This tool lets you write a regular expression, test it against sample text live, and see every match highlighted directly in context using standard JavaScript regex syntax.

How it works

Common use cases

Frequently asked questions

What does the 'g' flag do?

The global flag makes the regex find all matches in the text rather than stopping after the first one — without it, only the first match (if any) is reported, which is easy to forget when testing a pattern meant to match repeatedly.

Why does my pattern work here but not in my code?

Double-check that flags match (especially case-insensitivity with `i` and multiline with `m`), that special characters are escaped consistently with how your programming language handles regex string literals, and that you're not accidentally including the enclosing slashes or quotes as part of the pattern itself.

What's the difference between greedy and lazy quantifiers, like * and *??

A greedy quantifier (like `.*`) matches as much text as possible before backtracking if needed, while a lazy quantifier (`.*?`) matches as little as possible — this matters most with patterns spanning repeated delimiters, like extracting text between quotes when there are multiple quoted sections on one line.

Why did I get a 'regex is not valid' error?

The pattern has invalid regex syntax — common causes include an unclosed group `(`, an unescaped special character where a literal was intended, or an invalid combination of flags for the JavaScript regex engine.

This tool runs entirely in your browser — nothing you enter is sent to a server. Read more in the Privacy Policy, or browse the full list of tools.