Free · No sign-up · Data stays local

Regex Tester

Free online regex tester: live match highlighting, capture groups, replace preview and g/i/m flags — all running locally in your browser.

匹配高亮
匹配数量
0
第一个匹配
—
捕获分组数
0
匹配明细(含捕获分组)
替换结果

How to Use

  1. Enter the pattern and flags

    Type your rule in the pattern box (without slashes) and pick g / gi / gm / i / m as needed.

  2. Paste the test text

    Put the content you want to validate or extract into the text area; matches are highlighted live with the match count and first match.

  3. Preview the replacement

    Fill in the replacement field ($1 backreferences work) to see the replaced text instantly, then copy it with one click.

FAQ

Why do I only get one match?

The g (global) flag is not set. Without g, a regex returns only the first match — pick 'g global' or 'gi'/'gm' to list every match.

How do I read capture groups?

Anything wrapped in parentheses is a capture group. For example (\d{4})-(\d{2}) captures the year and month, and the match details panel lists each group value in order.

Do $1 and $2 work in the replacement?

Yes. The replacement field supports backreferences, so replacing (\d{4})-(\d{2}) with $1/$2 turns 2026-10 into 2026/10.

What happens if my pattern is invalid?

The browser throws a syntax error, which the tool shows as a message below the results. The page keeps working and recomputes as soon as you fix the pattern.

More Online Tools