RegEx Tester & Debugger
Test expressions with live capture highlights, build regex patterns using AI, and explore a library of common patterns.
🔑 How to get a free API key:
- Visit Google AI Studio and log in with your Google account.
- Click the blue "Get API key" button in the sidebar.
- Click "Create API key", select a project, and copy the key.
- Paste it above. No credit card required.
Character Classes
Any character except newline
Word character (alphanumeric + _)
Digit character (0-9)
Whitespace character (spaces, tabs, newlines)
Any character in range a to z
Any character NOT in range a to z
Quantifiers
0 or more occurrences
1 or more occurrences
0 or 1 occurrence (optional)
Exactly n occurrences
n or more occurrences
Between n and m occurrences
Anchors & Boundaries
Start of string / line
End of string / line
Word boundary
Non-word boundary
Groups & Lookarounds
Capturing group
Non-capturing group
Positive lookahead
Negative lookahead
What is the RegEx Tester & Debugger?
Regular expressions (regex) are powerful pattern-matching sequences used across every major programming language, text editor, and command-line tool to search, validate, and transform text. Whether you're parsing log files, validating form input, extracting data from HTML, or building search functionality, regex provides a concise syntax for describing complex text patterns. This tester lets you build and debug patterns interactively with real-time match highlighting, capture group inspection, and flag toggling — all running entirely in your browser with zero data uploads.
How to use the RegEx Tester & Debugger?
- Enter your regular expression in the pattern input field (without enclosing slashes). The tool validates syntax as you type and flags errors instantly.
- Select the flags you need: g (global — find all matches), i (case-insensitive), m (multiline — anchors match line boundaries), s (dotAll — dot matches newlines), or u (unicode).
- Paste or type your test string in the text area below the pattern. Matches are highlighted in real-time with alternating colours so overlapping groups are easy to distinguish.
- Inspect capture groups in the Matches panel on the right. Group 0 shows the full match; Groups 1, 2, etc. show each capturing parenthesis result.
- Browse the 'Common Patterns' tab to load pre-built expressions for emails, URLs, phone numbers, dates, and more. Click 'Use Pattern' to load any pattern into the tester instantly.
- Use the 'AI Generator' tab to describe what you want to match in plain English, and let AI produce a regex pattern with explanation and test examples.
- Click 'Copy Pattern' to copy your final regex (with flags) to the clipboard. All processing runs entirely in your browser — no data is ever uploaded to a server.
Frequently Asked Questions
Is this regex tester safe for sensitive text?
Yes, runs entirely in browser. Test text and patterns never leave your device.
What is a regular expression?
A sequence of characters defining a search pattern. Used for matching, finding, and replacing text in strings. Supported by all major programming languages.
What regex flags are supported?
g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky). Toggle them in the flags panel.
Why isn't my regex matching?
Common issues: forgetting to escape special characters (. * + ? ^ $ [ ] { }), missing anchors (^ $), incorrect flag usage, or greedy vs lazy quantifiers. Use the match highlighter to debug visually.
What is a capture group?
Parentheses ( ) create groups that extract portions of a match. Access groups by index in match results. Named groups use (?<name>pattern) syntax.
Can I test patterns from the pattern library?
Yes, each pattern in the Pattern Library page has a "Test in RegEx Tester" link that pre-loads the pattern into this tester.
RegEx Tester Features
Real-Time Match Highlighting
Matches are highlighted instantly as you type your pattern or test string. Alternating colours distinguish overlapping matches so you can visually scan results without confusion.
Capture Group Inspector
View every capturing group breakdown for each match. Group 0 shows the full match; numbered groups display individual sub-expression results with their position indexes.
JavaScript Regex Flag Support (g/i/m/s/u/y)
Toggle flags on and off with checkboxes. See immediately how global, case-insensitive, multiline, dotAll, unicode, and sticky modes affect your pattern results.
Curated Pattern Library
Browse pre-built patterns for emails, URLs, phone numbers, dates, IP addresses, passwords, and more. Click to load any pattern directly into the tester for immediate testing.
AI Regex Generator
Describe what you want to match in plain English and let AI produce a working regex pattern with an explanation, suggested flags, and test examples.
100% Client-Side & Private
All regex evaluation runs locally in your browser using the native JavaScript RegExp engine. No test data or patterns are ever sent to a server.
Related Developer Tools
Building or debugging patterns? These tools on InstantToolsHub pair well with the RegEx Tester: