SuperCalc

Regex Tester

Write, test, and debug regular expressions with live match highlighting, capture groups, and common pattern presets.

Regex Tester

Test regular expressions with live match highlighting.

//g

Common Patterns

Click a pattern to use it.

How it works

Regular expressions are patterns used to match character combinations in strings. This tester uses the browser's native RegExp engine, so results are identical to what your JavaScript code would produce.

Type a pattern, choose your flags, and paste a test string. Matches are highlighted in real time. Each match shows its text, index position, and any capture groups defined with parentheses.

The common patterns sidebar provides battle-tested patterns for email, URL, phone, date, and IP address matching. Click any pattern to load it into the tester.

FAQ

What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. It is used for pattern matching within strings — finding, replacing, or validating text. Nearly every programming language supports regex.
What are common regex patterns?
Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. URL: https?://[^\s]+. Phone: \d{3}-\d{3}-\d{4}. Date: \d{4}-\d{2}-\d{2}. IP address: \b(?:\d{1,3}\.){3}\d{1,3}\b.
What do regex flags mean?
g (global) finds all matches instead of stopping after the first. i (case-insensitive) ignores letter case. m (multiline) makes ^ and $ match line boundaries. s (dotAll) makes the dot match newlines too.
When should I use regex vs string methods?
Use simple string methods (includes, startsWith, indexOf) for literal text searches. Use regex when you need pattern matching, character classes, quantifiers, or capture groups. Regex is more powerful but harder to read and debug.
How do I match an email or URL?
Use the common patterns provided in the sidebar. Note that truly RFC-compliant email validation requires extremely complex patterns. For most applications, a simpler pattern plus server-side verification is the practical approach.
Is regex slow?
Simple patterns are fast. Catastrophic backtracking can occur with nested quantifiers like (a+)+b on certain inputs, causing exponential time. Avoid nested repetitions and use atomic groups or possessive quantifiers when available.