Regex Tester & Debugger

Test, debug, and visualize regular expressions in real time. See highlighted matches with capture group details, flags, and match positions directly in your browser.

Other Coding Tools


Online Regex Tester and Regular Expression Debugger

Test and debug regular expressions directly in your browser with real-time match highlighting, capture group visualization, and detailed match information. This regex tester runs entirely client-side with no data sent to any server, making it safe for testing patterns against sensitive text.

What is a regex tester?

A regex tester is a tool that lets you write a regular expression pattern and immediately see how it matches against sample text. Instead of running code to check whether your pattern works, you type the regex and test string, and the tool highlights all matches in real time. Capture groups are shown with distinct colors so you can verify that each part of your pattern captures the correct substring.

How do I use this regex tester?

Enter your regular expression in the pattern input field at the top. The input is formatted as a standard regex literal with surrounding slashes. Type or paste your test content into the code editor below. Matches appear highlighted instantly as you type. Toggle flags like global, case-insensitive, multiline, dotall, or unicode using the checkboxes. The match results panel lists every match with its position, full matched text, and any captured groups.

What are regex flags and when should I use them?

Regex flags modify how the pattern engine processes your expression. The global (g) flag finds all matches rather than stopping at the first one. Case-insensitive (i) matches letters regardless of uppercase or lowercase. Multiline (m) makes ^ and $ match the start and end of each line instead of the entire string. Dotall (s) lets the . metacharacter match newline characters. Unicode (u) enables full Unicode code point matching and makes character classes like \w aware of Unicode letters.

What are capture groups in regular expressions?

Capture groups are portions of a regex pattern enclosed in parentheses. When the pattern matches, each group captures the substring it matched, which you can then reference by index or by name. For example, (\w+)@(\w+\.\w+) has two groups: one for the username and one for the domain in an email address. This tool shows each group with a distinct color so you can immediately see which part of the match belongs to which group.

How do named capture groups work?

Named capture groups use the syntax (?<name>pattern) to assign a label to a group. Instead of referencing the group by its numeric index, you can use the name in replacement strings or in code. This tool displays named groups with their name and index, making it straightforward to verify that each named group captures the intended substring.

Is it safe to test regex patterns with sensitive data here?

Yes. This regex tester runs entirely in your browser using JavaScript's built-in RegExp engine. No data is transmitted to any server. Your patterns and test strings remain on your machine throughout the session, making it safe to test against private or confidential content.

How are matches highlighted in the editor?

Each full match is highlighted with a blue underline and background color directly in the code editor. If your pattern contains capture groups, each group is overlaid with a distinct color: orange for group 1, green for group 2, purple for group 3, and so on. A color legend below the editor explains which color corresponds to which group. This makes it easy to visually parse complex patterns at a glance.

Can I test multiline text and patterns?

Yes. The test string editor supports multiple lines with line numbers. Enable the multiline flag (m) to make ^ and $ anchors match the beginning and end of each line rather than the entire string. Enable the dotall flag (s) if you need the . metacharacter to match across line breaks.

What regex syntax does this tool support?

This tool uses the JavaScript RegExp engine built into your browser. It supports all standard regex syntax including character classes, quantifiers, alternation, lookahead, lookbehind, named and numbered capture groups, non-capturing groups, backreferences, and Unicode property escapes when the u flag is enabled. The behavior matches exactly what new RegExp() produces in JavaScript.

How do I match email addresses or URLs with regex?

Common patterns include [\w.-]+@[\w.-]+\.\w+ for basic email matching and https?://[^\s]+ for URLs. Paste these patterns into the regex input and enter sample text containing emails or URLs to verify the matches. The capture group display helps refine patterns that extract specific parts like the domain or path.

Navigator

Quickly navigate to any tool