OnlineNotes Logo

    Regex Tester

    Validate regex patterns, inspect capture groups, and confirm match scope with highlighted preview.

    Pattern and input

    Output

    Ready

    Highlighted preview

     

    Matches

    0

    Capture groups

    0

    Flags

    g

    When to use this tool

    Use regex testing when validating extraction patterns, migration scripts, or text normalization rules.

    Capture groups and index data help verify precise matching behavior before code changes.

    Frequently asked questions

    Does this regex tester support JavaScript regex flags?

    Yes. You can toggle common flags such as global, case-insensitive, multiline, dotAll, unicode, and sticky.

    Can I inspect capture groups?

    Yes. Each match result includes the match index and any capture group values.

    Does this tool highlight matches in text?

    Yes. The preview panel highlights matched segments so you can verify pattern scope quickly.

    Related tools

    Regex tester online for JavaScript pattern and capture-group debugging

    Use this regex tester online to try a JavaScript pattern, see each capture group, and confirm where each match starts and ends before you put it in code.

    Matches are highlighted in your text and listed in a plain report, which helps when you debug log parsing, extraction scripts, or form validation rules.

    How it works

    1. Type the pattern without slashes, tick the flags you want (g, i, m, s, u, y), add test text, and press Run regex test. Edits and flag changes do not rerun by themselves: the status line asks you to run it.
    2. Your browser's own RegExp engine runs the pattern, so results match JavaScript in that browser. Invalid patterns show the engine's error message in the output panel.
    3. The output highlights each match in the text and writes a report with each match's index, value, and groups.
    4. The counters show matches, total groups, and active flags. Copy match report copies the report text, including the pattern and flags.

    Worked example

    Input

    Pattern: (\d{4})-(\d{2})
    Flags: g
    Text: Paid 2025-11, due 2026-03.

    Output

    Pattern: /(\d{4})-(\d{2})/g
    
    match 1:
      index: 5
      value: 2025-11
        group 1: 2025
        group 2: 11
    
    match 2:
      index: 18
      value: 2026-03
        group 1: 2026
        group 2: 03

    Index counts from 0 in UTF-16 units, so "2025-11" starts at position 5. The Groups counter shows 4, because it adds up the groups of every match instead of counting those in the pattern.

    Edge cases and limits

    • The flags behave as they do in your code: with g unticked you get the first match only, and y matches only from the start of the text unless g is also on. The list stops at 5,000 matches.
    • Named groups work, but the report lists them by number, not by name. A group that did not take part in a match shows "(empty)", the same as one that matched an empty string.
    • Only JavaScript syntax runs. Slashes are read as literal characters, so typing /abc/g searches for those slashes. Inline "(?i)" and possessive "a++" give errors here, though they work in some other languages. There is no replace mode, and the d and v flags have no checkbox.
    • The pattern runs in a background worker and stops after 2 seconds, so catastrophic backtracking, such as (a+)+$ on a long run of a's followed by another character, shows a message and leaves the tab usable.

    When to use it

    • Test capture groups in a JavaScript pattern, including named ones.
    • Check multiline matching against a changelog or log sample.
    • See how the sticky flag limits matches to one unbroken run.
    • Copy a match report into a PR description or bug ticket.