Regex Tester
Test and debug regular expressions with real-time highlighting
//g
About Regex Tester
This free online Regex Tester lets you build, test, and debug regular expressions in real time using JavaScript's native RegExp engine. Matches are highlighted instantly as you type, and full match details including capture groups, named groups, and match indices are displayed below.
Regex Syntax Quick Reference
Character Classes
.— Any character (except newline)\d— Digit (0-9)\D— Non-digit\w— Word character (a-z, A-Z, 0-9, _)\W— Non-word character\s— Whitespace\S— Non-whitespace[abc]— Any of a, b, or c[^abc]— Not a, b, or c[a-z]— Character range
Quantifiers
*— 0 or more+— 1 or more?— 0 or 1{n}— Exactly n{n,}— n or more{n,m}— Between n and m*?— Lazy (non-greedy) 0++?— Lazy (non-greedy) 1+
Anchors & Boundaries
^— Start of string/line$— End of string/line\b— Word boundary\B— Non-word boundary
Groups & Lookaround
(abc)— Capture group(?:abc)— Non-capturing group(?<name>abc)— Named group(?=abc)— Positive lookahead(?!abc)— Negative lookahead(?<=abc)— Positive lookbehind(?<!abc)— Negative lookbehinda|b— Alternation (a or b)
JavaScript Regex Flags
g— Global: find all matches instead of stopping at the first.i— Case-insensitive: letters match both upper and lower case.m— Multiline:^and$match line starts/ends.s— Dotall:.also matches newline characters.u— Unicode: enables full Unicode matching with proper surrogate pair handling.
How to Use This Tool
- Type your regular expression in the pattern field.
- Toggle flags (g, i, m, s, u) using the buttons.
- Enter your test string in the text area.
- Matches are highlighted in real time with full details shown below.
- Use the Replace panel to test string replacement with capture group references.
- Browse common patterns for quick reference and one-click loading.
All processing happens entirely in your browser. No data is sent to any server, making this tool completely private and secure. The tool uses JavaScript's built-in RegExp engine, so results match what you would get in Node.js or any modern browser.