ASG ToolsPowered by ASG Groups
Developer Utilities

Regex Tester & Debugger

The problem: Writing and debugging regular expressions involves a slow trial-and-error cycle — paste to regex101, wait for a page load, repeat.

ASG Privacy VerifiedVerified

100% In-Browser Execution. Zero server uploads. Your data never leaves this tab — disconnect your internet and the tool keeps working.

Regex Tester & Debugger: the complete guide

A regex tester is the interactive scratchpad for writing, testing and debugging regular expressions. Regular expressions are pattern-matching mini-languages used in virtually every programming language for validation (is this a valid email?), extraction (pull the price from this product description), transformation (replace all US phone formats with one canonical form) and routing (match this URL path). Writing them without a live testing environment is essentially guessing — changing one character can flip a match to a non-match or accidentally make .* match across newlines. This tester shows all matches highlighted in real time, with each match's index, length and capture groups listed below.

Understanding flags and their effects

The five commonly used JavaScript regex flags dramatically change pattern behavior. The g (global) flag finds all matches instead of stopping at the first. The i (insensitive) flag makes matching case-insensitive, so [A-Z] also matches lowercase. The m (multiline) flag makes ^ match the start of each line rather than only the start of the string — essential for multi-line input. The s (dotAll) flag makes . match newline characters, which it normally skips — useful for matching across lines. Combining flags is common: gi finds all case-insensitive matches, gm enables multi-line anchors globally. Misunderstanding flag interactions (especially g and lastIndex behavior in exec loops) is a frequent source of infinite loops and missing matches.

Capture groups and named groups

Parentheses in a regex create capture groups: each ( ) subpattern captures its match into a numbered slot ($1, $2, ...) or, with (?<name>...) syntax, into a named slot ($<name>). Capture groups are essential for extraction tasks: the pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) on an ISO date string produces three named groups you can access by name instead of index. Non-capturing groups (?:...) group without capturing — useful for alternation (foo|bar) or repetition applied to a subpattern without creating a group you have to count. The tester shows every capture group and named group for every match, which is the fastest way to verify that your grouping structure is working correctly.

Step by step: how to use Regex Tester

  1. 1

    Type your regex pattern in the input between the slashes. Start simple and build up.

  2. 2

    Toggle flags (g, i, m, s) using the letter buttons next to the pattern input.

  3. 3

    Paste or type your test string in the Test String area — matches are highlighted in real time.

  4. 4

    Review the Matches panel to see each match's full text, position, and capture groups.

  5. 5

    Use the Presets dropdown to load common patterns like email, URL, phone, hex color.

  6. 6

    Expand the Replacement section to test find-and-replace, using $1, $2 or $<name> in the replacement string.

Security & privacy

Regex matching runs entirely in your browser using the native JavaScript RegExp engine. Your test strings — which may contain production log lines, customer data or sensitive identifiers — are never transmitted to any server. ReDoS (Regular Expression Denial of Service) attacks from catastrophically backtracking patterns are mitigated by the iteration limit of 200 matches per test run.

Frequently asked questions