Answer: The Regex Tester & Debugger produces your output instantly from the input you provide — everything runs in your browser, free, with no signup required.
Test regular expressions with real-time match highlighting
. Any character\d Digit [0-9]\w Word character\s Whitespace^ Start of string$ End of string* 0 or more+ 1 or more? 0 or 1{n,m} n to m repeats[abc] Character set(...) Capture groupThis regex tester evaluates your patterns live against sample text, highlighting matches, capture groups, and boundaries as you type. It uses your browser's JavaScript regex engine, so behavior matches what your web code will actually do.
Regular expressions are a miniature language for describing text shapes. Ten or so concepts cover ninety percent of practical regex — and knowing them beats memorizing patterns.
Because the tester runs entirely in your browser, nothing you type is uploaded, and results appear on every keystroke with no submit button. Paste a log excerpt, a CSV line, or a user-submitted form field into the test string area, then iterate on the pattern until the highlights land exactly where you expect. Capture groups appear below the matches so you can confirm each group grabs the right slice of text before the pattern ships into production code.
Character classes match sets: \d (digits), \w (word characters), \s (whitespace), and negations \D, \W, \S. The dot matches any character except newline. Anchors position rather than consume: ^ start of line/string, $ end, \b word boundary.
Quantifiers repeat: * (zero or more), + (one or more), ? (optional), and {n,m} (between n and m). Alternation with | offers choices, and parentheses capture for reuse — either in replace patterns ($1) or back-references (\1). Flags change meaning: i (case-insensitive), g (all matches), m (^/$ per line).
The table lists the patterns that solve most everyday tasks, each with a concrete example match. These follow standard syntax shared by JavaScript, Python, and PCRE.
Compose them: an email shape check like [\w.+-]+@[\w-]+\.[\w.]+ catches obvious typos (missing @ or TLD) while deliberately not attempting full RFC 5322 validation, which is famously impractical — the spec permits addresses no simple pattern accepts.
| Pattern | Example match | Use |
|---|---|---|
| \d{3}-\d{4} | 555-1234 | Phone-style segment |
| [\w.+-]+@[\w-]+\.[\w.]+ | user@example.com | Email shape check |
| ^https?://[^\s/$.?#].[^\s]*$ | https://example.com | URL shape (Fleischman/Gruber style) |
| \b\d{1,3}(\.\d{1,3}){3}\b | 192.168.1.1 | IPv4 shape |
| ^(\d{4})-(\d{2})-(\d{2})$ | 2026-08-26 | ISO date with capture groups |
| (?i)\berror\b | ERROR: failed | Case-insensitive flag (inline) |
Quantifiers are greedy by default: <.*> on '' matches the whole string because .* stretches to the last '>' — add ? for the lazy version (<.*?>) that stops at the first. This greedy/lazy distinction is the most common regex bug.
Nested quantifiers like (a+)+ can trigger catastrophic backtracking — exponentially many retry paths on a non-matching input — which freezes engines and ReDoS-vulnerable websites. Keep quantifiers non-overlapping and prefer explicit character classes (e.g. [^<]* instead of .*) when a delimiter exists.
Regex cannot parse nested structures (HTML, JSON, arithmetic) because regular languages don't support recursion — the classic admonition is to not parse HTML with regex. Use regex to find tokens, then a real parser for structure.
Test discipline: always include should-match AND should-NOT-match cases, boundaries (empty string, unicode, accents), and the pathological backtracking input if your pattern has adjacent quantifiers. This tool shows every match with its groups, making misses visible at a glance.
['Regex syntax is mostly portable, but engines differ: JavaScript supports lookbehind in modern browsers, named groups as (?
What does \d mean in regex?
\d matches any single digit (0-9). Its negation \D matches any non-digit. Related: \w matches word characters (letters, digits, underscore), \s matches whitespace, each with an uppercase negation.
What's the difference between * and +?
* matches zero or more of the preceding element; + requires at least one. So a* matches the empty string but a+ does not. Both are greedy — add ? (*?, +?) for lazy matching that stops at the first opportunity.
How do I test if a string matches a regex in JavaScript?
Use /pattern/.test(string) for a boolean, or string.match(/pattern/g) to get all matches. This tester runs the same JavaScript engine, so results here equal results in your code.
What is catastrophic backtracking?
When nested quantifiers like (a+)+ fail to match, the engine retries exponentially many sub-paths, hanging the process. Avoid adjacent ambiguous quantifiers and prefer bounded classes like [^x]* — the vulnerability class is known as ReDoS.
Can regex parse HTML or JSON?
No. Regular expressions cannot handle arbitrary nesting — that requires a context-free grammar and a real parser. Regex is fine for finding tokens inside HTML (like an attribute value) but not for validating document structure.