.* 正则表达式在线测试 — 测试正则表达式
Test regular expressions with live match highlighting. See all matches, capture groups, and positions. Supports g, i, m, s flags. Free online regex tester.
Enter your regex pattern and test string, then see all matches highlighted in real-time. Capture groups are shown with their indices. Toggle flags (global, ignore-case, multiline, dotAll) and see results update instantly. Uses JavaScript's native RegExp engine.
How to Use
Enter a pattern
Type your regular expression in the pattern field. Use the checkboxes to enable flags: g (global), i (ignore case), m (multiline), s (dotAll).
Add your test string
Paste or type the string you want to test in the Test String area. All matches are highlighted live as you type.
Inspect matches
See the total match count, each match with its position, and any capture groups. Copy the verified pattern to use in your project.
Frequently Asked Questions
完整指南:正则表达式测试工具
什么是正则表达式?
正则表达式(regex)描述文本模式,用于搜索、验证和转换文本。是表单验证、日志分析和数据管道文本转换的必备工具。
支持:捕获组、前瞻断言、后顾断言、反向引用和g、i、m标志。
如何使用
- 在顶部字段输入模式(不含分隔符)。
- 选择标志:g(全局)、i(不区分大小写)、m(多行)。
- 在文本区域输入测试文本——匹配项实时高亮显示。
- 在结果面板查看捕获组。
专业技巧
- 不需要引用组时使用非捕获组
(?:...)。 g标志查找所有匹配;不加则只返回第一个。- 验证邮箱请使用库——完整的邮箱正则表达式极其复杂。