Regex Tester — Test & Debug Regular Expressions Online
Test and debug regular expressions with real-time match highlighting, capture groups, replace mode, pattern explanation and a built-in library. 100% browser-based, free.
Regex Tester — Test & Debug Regular Expressions Online Test and debug regular expressions with real-time match highlighting, capture groups, replace mode, pattern explanation and a built-in library. 100% browser-based, free.
Character Classes
.Any character except newline\dDigit [0-9]\DNon-digit\wWord char [A-Za-z0-9_]\WNon-word char\sWhitespace\SNon-whitespace[abc]a, b, or c[^abc]Not a, b, or c[a-z]Range a to zAnchors
^Start of string/line$End of string/line\bWord boundary\BNon word boundaryQuantifiers
*0 or more+1 or more?0 or 1 (also makes lazy){n}Exactly n{n,}n or more{n,m}Between n and m*?Lazy 0 or moreGroups & References
(abc)Capture group(?:abc)Non-capturing group(?<name>abc)Named group\1Backreference to group 1a|bAlternation: a or bLookarounds
(?=abc)Positive lookahead(?!abc)Negative lookahead(?<=abc)Positive lookbehind(?<!abc)Negative lookbehindFlags
gGlobal — all matchesiCase insensitivemMultilinesDotall (. matches newline)uUnicodeyStickydHas indicesFeatures
Real-time Match Highlighting
See matches highlighted in your test string as you type the pattern. Capture groups are color-coded so you can spot exactly what each part of your regex captures.
Pattern Explanation Panel
Every part of your pattern is broken down into plain English: anchors, character classes, quantifiers, groups, lookarounds — so you understand why it matches (or does not).
Regional Pattern Library
One-click load for 16+ common patterns including email, URL, IPv4, UUID, hex color, US ZIP / SSN / credit card and slug. Switch to the Chinese library for mobile phone, ID card, postal code patterns.
Match & Replace Modes
Toggle between match mode (see all matches and capture groups) and replace mode (preview the replacement output in real time with $1, $2 backreferences).
Built-in Cheatsheet
Collapsible quick reference for character classes, anchors, quantifiers, groups, lookarounds and flags — never leave the page to look up syntax.
100% Browser-Based
Patterns and test strings are processed entirely in your browser via native JavaScript RegExp. Nothing is uploaded to any server. Your data stays private.
How to use the Regex Tester
- Type or paste your regular expression in the Pattern input, e.g. \d{4}-\d{2}-\d{2}
- Toggle the flags you need: g (global), i (case-insensitive), m (multiline), s (dotall), u (Unicode), y (sticky), d (indices)
- Paste your test string in the Test String area — matches highlight in real time
- Browse the Matches panel to see each match's position, length and capture groups
- Switch to Replace mode and enter a replacement string (use $1, $2 for capture groups) to preview the rewrite
Common Use Cases
Validating email and phone inputs
Build and test patterns for form validation before pasting them into your code. Confirm edge cases like + in email locals or country-specific phone formats actually match.
Debugging existing patterns
Copy a regex from production that "stopped working" and run it against the failing input. The Explanation panel often reveals an unintended . that matches more than expected.
Bulk find-and-replace
Use Replace mode to clean up messy text: collapse multiple spaces, swap date formats, rewrite URLs, or extract fields. Copy the result back into your editor.
Learning regex
New to regex? Load a pattern from the Library, study the Explanation panel, then tweak the pattern and watch how matches change. The Cheatsheet covers all the syntax in one panel.
Code review prep
Before approving a PR that adds a regex, paste it here and verify it handles the edge cases the author claims. Catastrophic-backtracking patterns become obvious.
Log parsing
Test patterns for extracting timestamps, status codes or trace IDs from a sample log line before deploying the pattern in your log pipeline or grep workflow.
Pro Tips
- ✓ Use the d flag to get match indices — useful when you need start/end positions, not just the matched text.
- ✓ Named groups (?<name>...) make complex patterns self-documenting and easier to maintain than (\d+)-(\d+)-(\d+).
- ✓ Prefer non-capturing groups (?:...) over (...) when you do not need to reference the group — slightly faster and signals intent.
- ✓ Use Unicode property escapes like \p{L} (any letter) with the u flag for proper multilingual matching instead of [a-zA-Z].
- ✓ When matching across newlines, prefer the s flag (dotall) over [\s\S] — clearer and equivalent.
- ✓ For very long patterns, build incrementally: start small, verify each step matches, then add complexity. The Explanation panel guides you.
Frequently Asked Questions
What is a regex tester?
Which regex flavor does this tool support?
How do I use capture groups and named groups?
What is the difference between match mode and replace mode?
How do I avoid catastrophic backtracking?
Is my regex sent to any server?
More Tools
Diff Checker — Compare Two Texts Online
Compare two texts side by side and find differences instantl...
JSON Formatter, Validator & Converter
Format, validate, and convert JSON to XML or YAML instantly ...
Case Converter
Convert text between uppercase, lowercase, title case, camel...
Word & Character Counter
Count words, characters, sentences, and paragraphs instantly...