Test your regular expressions with sample text. This tool processes all data locally in your browser. No information is ever sent to any server. Completely free, no registration required.
A Regex Tester lets you write, test, and debug regular expressions in real time against sample text, with match highlighting, capture group extraction, and detailed explanations. Regex is one of the most powerful yet frustrating tools in a developer's toolkit — a single well-crafted regex can replace dozens of lines of string manipulation code, but even experienced developers struggle to write correct patterns on the first try. This tester provides instant visual feedback: matches light up as you type, unmatched parts are clearly shown, and every capture group is labeled.
Enter your regex pattern and test text. As you type, the tester highlights all matches in real time. Below the match results, captured groups are listed by number and name. The explainer breaks down each component of your regex in plain English: /^(\d{3})-(\d{2})-(\d{4})$/ → 'start of string, capture group 1: exactly 3 digits, literal hyphen, capture group 2: exactly 2 digits, literal hyphen, capture group 3: exactly 4 digits, end of string.' Supported flags: g (global), i (case insensitive), m (multiline), s (dotall).
Common Regex Tokens:\n• ^ start, $ end, . any char, * 0+, + 1+, ? 0 or 1\n• {n} exactly n, {n,} n+, {n,m} n to m\n• [abc] character class, [^abc] negated class\n• \\d digit, \\w word, \\s whitespace, \\b word boundary\n• (abc) capture group, (?:abc) non-capturing\n• (?<name>abc) named capture group\n• | alternation (OR)\n• (?=...) lookahead, (?<=...) lookbehind\n\nFlags: /g global, /i case-insensitive, /m multiline (^$ match line), /s dotall (. matches \\n)\n\nEmail Regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/\nURL Regex: /^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b/
By default, quantifiers (*, +, ?) are greedy — they match as much as possible. Adding ? makes them lazy — they match as little as possible. 'Hello World' with /H.*o/ matches 'Hello Wo' (greedy, stops at last o). /H.*?o/ matches 'Hello' (lazy, stops at first o).
Different languages support different regex features. JavaScript doesn't support lookbehinds in older browsers. Python needs raw strings r'...'. PHP uses PCRE which has different escape rules. Always test in the same engine/environment as your production code.
Free online Regex Tester — no signup, 100% client-side processing. All data stays in your browser.