Regex Tester

Test and debug regular expressions with real-time pattern matching. Supports flags, capture groups, and comprehensive syntax highlighting.

Sample Patterns:
Regular Expression
//
Test String
Sample texts:
Regex Quick Reference

Character Classes

  • . - Any character
  • \d - Digit
  • \w - Word
  • \s - Whitespace
  • [abc] - Set

Anchors

  • ^ - Start
  • $ - End
  • \b - Word boundary
  • \B - Non-boundary

Quantifiers

  • * - 0+
  • + - 1+
  • ? - 0/1
  • {n} - Exactly n
  • {n,} - n+

About the Regex Debugger

This regex debugger breaks a pattern into its tokens and explains what each one does, alongside the matches and capture groups. It is aimed at understanding a pattern rather than only testing whether it fires.

A regex debugger answers a different question from a tester. Testing tells you whether a pattern matches; debugging tells you why — which is what you need when the pattern came from a colleague, a Stack Overflow answer or your own code six months ago.

The token breakdown is the useful part. A dense expression full of escapes, groups and quantifiers is opaque as one string and straightforward once each component is labelled: this is a character class, this quantifier is lazy, this group captures, this assertion looks ahead without consuming.

Capture group contents are shown per match, which is how you find the classic bug where a pattern matches correctly but a group takes more than intended. For quick iteration against sample text, the regex tester is the lighter option.

How to use the Regex Debugger

  1. Paste the pattern. Enter the regular expression you want to understand.
  2. Read the breakdown. Each token is labelled and explained.
  3. Add sample text. Provide input to see what actually matches.
  4. Inspect the groups. Check what each capture group holds for every match.

Regex Debugger features

  • Token-by-token pattern explanation
  • Match highlighting against sample text
  • Capture group contents per match
  • Flag effects explained
  • Greedy versus lazy quantifiers made explicit
  • Runs entirely in your browser

Frequently asked questions

How is this different from a regex tester?

A tester shows whether a pattern matches. This explains why, by labelling each token in the expression.

Can it explain a pattern I found online?

Yes. That is the main use — understanding a pattern before trusting it in your own code.

Does it show capture group contents?

Yes, per match, which is how you find a group that captured more than intended.

Are lookarounds explained?

Yes. Assertions are labelled as such, including whether they look ahead or behind and whether they are negative.

Is my pattern uploaded?

No. Analysis happens entirely in your browser.