C
All Tools
🔎

Regex Tester

Test regular expressions against any text. See all matches, capture groups and character positions.

//

Regular expressions are one of the most powerful tools in a developer's toolkit — and one of the most frequently misunderstood. Writing a regex that works exactly right requires testing it against real data. This Regex Tester lets you write a pattern with flags, test it against any text, and instantly see all matches highlighted with their character positions and capture groups. No more trial-and-error debugging in code just to test a regex pattern.

📋 How to Use This Calculator

Enter your regex pattern in the pattern field (without the slashes — just the pattern itself). Toggle the flags you need: g (global — find all matches, not just the first), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dotAll — dot matches newlines). Paste your test text in the second area. Click "Test Regex" to see all matches listed with their position (index) in the string. Green means matches found, yellow means no matches. Capture groups (from parentheses in your pattern) are shown next to each match.

💡 Key Facts & Information

Regular expression syntax used here is JavaScript's RegExp, which is ECMAScript compliant. Key syntax: . (any char except newline), * (0 or more), + (1 or more), ? (0 or 1), {n,m} (n to m repetitions), ^ (start of string or line), $ (end), [] (character class), [^] (negated class), () (capture group), (?:) (non-capturing group), | (alternation), \d (digit), \w (word char), \s (whitespace), \ (word boundary). Lookaheads (?=...) and lookbehinds (?<=...) are supported in modern JavaScript. Named capture groups (?<name>...) are also supported.

Frequently Asked Questions

Disclaimer: The results provided by this calculator are for informational and educational purposes only. They do not constitute financial, medical, or legal advice. Always consult a qualified professional before making financial or health decisions. Actual results may vary based on individual circumstances.

⚙️ More Developer Tools Tools

View all Developer Tools tools →