⚡ Regex Tester & Debugger
Test regular expressions live with real-time match highlighting. See captured groups, match indices, and preview find-and-replace output instantly — all in your browser, nothing sent anywhere.
Click any pattern to load it into the tester. Hover for tooltip descriptions.
Frequently Asked Questions
What regex flavor does this tester use?
This tool uses JavaScript's native RegExp engine — the same one running in Chrome, Firefox, and Node.js. It supports flags g (global), i (case-insensitive), m (multiline), and s (dotAll). Modern JavaScript regex also supports named groups ((?<name>...)), lookbehind assertions, and Unicode mode.
What do the g, i, m, s flags mean?
g (global) — finds all matches instead of stopping after the first. i (case-insensitive) — hello also matches HELLO. m (multiline) — ^ and $ match the start and end of each line. s (dotAll) — the dot . matches newline characters \n as well.
How do I use capturing groups and reference them in replace?
Wrap part of your pattern in parentheses: (\w+)\s+(\w+) creates two groups. Each group's match is shown in the results panel. In the Replace field, use $1, $2 to reference them. Named groups use (?<name>...) and can be referenced as $<name>.
What is greedy vs non-greedy (lazy) matching?
Greedy quantifiers (*, +, ?) consume as many characters as possible. Add ? to make them lazy: *?, +?. Example: in <b>hello</b><b>world</b>, the pattern <b>.*</b> (greedy) matches the whole string, while <b>.*?</b> (lazy) matches only <b>hello</b>.
How do I match a specific number of characters?
Use curly-brace quantifiers: {n} matches exactly n times, {n,} matches n or more, {n,m} matches between n and m. Examples: \d{4} matches exactly 4 digits, [A-Za-z]{3,8} matches 3–8 letters.
How do I match a whole word vs part of a word?
Use \b (word boundary) anchors. \bcat\b matches the word "cat" but not "cats" or "concatenate". Without boundaries, cat would match inside "concatenate". Combine with i flag for case-insensitive whole-word matching.
Free Online Regex Tester — Real-Time JavaScript Regular Expression Debugger
Our regex tester lets you write, test, and debug regular expressions directly in your browser with zero latency. Unlike server-based tools, everything runs client-side using JavaScript's native RegExp engine, so your test strings and patterns are never sent to any server.
What Is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex is used in programming languages, text editors, and command-line tools to find, extract, validate, and replace text. They are supported in JavaScript, Python, Java, PHP, Ruby, Go, Rust, and virtually every modern programming language.
Key Features of This Regex Tester
- Live match highlighting — Matches are highlighted in real time as you type, with distinct colors for different capturing groups.
- Captured groups panel — Every match shows its position index and all captured groups (numbered and named).
- Find & Replace preview — Enter a replacement string using
$1,$2,$&references and see the full result instantly. - Regex flags — Toggle global (
g), case-insensitive (i), multiline (m), and dotAll (s) flags with one click. - Cheat sheet — Built-in reference of the most common regex patterns with click-to-load functionality.
- 100% private — All processing uses your browser's JavaScript engine. No data is transmitted.
Common Regex Use Cases
Email validation: ^[\w.+-]+@[\w-]+\.[a-z]{2,}$ — validates that a string looks like an email address. URL matching: https?://[\w./%-]+ — extracts URLs from text. Date parsing: (\d{4})-(\d{2})-(\d{2}) — captures year, month, and day from ISO date strings. IP address: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b — finds IPv4 addresses in text.
How to Use Regex Flags
The g (global) flag is the most commonly used — without it, the pattern only matches the first occurrence. Add i when case doesn't matter (e.g., matching HTML tags regardless of case). Use m when your test string contains multiple lines and you want ^/$ to anchor to each line. Use s (dotAll) when your pattern uses . and your text may contain newlines.