DEV NO.004
Regex Tester
Live match highlighting, capture-group panel and a cheat sheet of common patterns.
This tool runs entirely in your browser. Nothing is uploaded to any server.
What is this
什么是正则测试器
写正则最大的痛点是「不知道它到底匹配了什么」。本工具输入模式与文本后实时高亮每一处匹配,并列出所有捕获组(含命名分组),配合 i/g/m/s/u 标志开关,所见即所得。
What is a regex tester
The hard part of writing regex is knowing what it actually matches. This tool highlights every match live as you type and lists all capture groups, with toggles for the i / g / m / s / u flags.
如何使用
- 输入正则(无需写两侧斜杠),按需点亮标志位。
- 粘贴测试文本,匹配处即时高亮。
- 在面板中查看每个匹配的完整内容与捕获组;正则卡住时参考下方速查。
常用正则速查
- 邮箱:
[\w.+-]+@[\w-]+\.[\w.]+ - URL:
https?://[^\s]+ - 中国手机号:
1[3-9]\d{9} - IPv4:
\d{1,3}(\.\d{1,3}){3} - 日期
YYYY-MM-DD:\d{4}-\d{2}-\d{2}
FAQ
Which regex flavor is used?
It uses JavaScript's native RegExp engine — exactly what your browser runs — including named capture groups.
Why add the g flag for all matches?
Without the g flag the engine returns only the first match. The tester scans globally, but you control the flags.
What if testing on a huge text is slow?
Test on a representative excerpt first. Catastrophic backtracking can make some patterns exponentially slow on long inputs.