代码、数据与二维码工具

正则测试器

根据输入计算、校验或分析正则tester。

优先本地处理无需注册隐私说明 ↗

Enter the pattern only, without surrounding slashes. JavaScript RegExp syntax is used.

Flags

Maximum 200,000 UTF-16 characters. Matching happens locally.

使用步骤

如何使用

  1. Enter a JavaScript regular expression and choose its flags.
  2. Paste the text to test, then select Test expression.
  3. Review each match, its capture groups, and the source position or fix any reported error.

JavaScript RegExp behavior

This tester uses the browser’s built-in RegExp engine, so syntax, flags, Unicode behavior, lookarounds, backreferences, and named groups follow the JavaScript version supported by your browser.

Match details you can inspect

Each result shows the complete match, zero-based source index, end position, and capture groups. Named captures are labeled when the browser provides them. Global and sticky expressions are evaluated repeatedly; other expressions show their first match.

Private and local

The expression and test text stay in this browser. Inputs are limited to 200,000 UTF-16 characters each, and the page does not send them to a server or fetch remote pattern libraries.

常见问题

你可能还想知道

Which regex flavor does this use?

It uses the browser JavaScript RegExp implementation, rather than PCRE, Python, Ruby, or another server-side flavor. Check the target JavaScript runtime when portability matters.

Why do I only see one match?

Without the g or y flag, JavaScript RegExp returns the first match. Enable g to find all non-overlapping matches, or y for repeated matches at the current position.

Are my expressions uploaded?

No. Matching and error reporting happen locally in your browser.

What does an empty capture group mean?

A group can participate with an empty string, or be unmatched and shown as an em dash. The tester preserves that distinction in the result.