All tools
.*

Regex Tester

Test a regular expression against sample text and see every match highlighted.

Testing & debugging
//
test string
0 chars
Overview

About this tool

Test a regular expression against sample text and see every match — and every capture group — highlighted live as you type, instead of testing blind against real code or production data.

01

Why capture groups matter

Getting the overall pattern right is usually the easy part; capture groups are where most regex bugs actually live. Seeing exactly what group 1, group 2, and so on captured against your specific input makes it far faster to spot a misplaced parenthesis than reading the pattern alone.

02

JavaScript regex, not a universal standard

Patterns here run on JavaScript's regular expression engine. Most syntax carries over to other languages, but details like named-group syntax or lookbehind support can differ — always confirm a pattern against your actual target language before shipping it.

03

A note on performance

This tool is for building and understanding a pattern, not for benchmarking it. Certain patterns — particularly ones with nested quantifiers — can become extremely slow against specific inputs (catastrophic backtracking) regardless of which language ultimately runs them. If a pattern feels slow here, it likely will be in production too.

Frequently asked questions

Why isn't my pattern matching anything?

Common culprits: a missing global flag when you expect multiple matches, an unescaped special character like . or ( that you meant literally, or a greedy quantifier consuming more than intended. Try simplifying the pattern until you find the part that isn't behaving as expected.

What do the highlight colors mean?

Each full match gets one color; capture groups within a match are distinguished so you can see exactly which part of the text each group corresponds to.

Can I test against multiple lines at once?

Yes — paste multi-line text into the sample box, and toggle the multiline flag if you want ^ and $ to match the start and end of each line rather than the whole string.