.* Regex Tester
Test and debug regular expressions live with real-time match highlighting. Supports flags, capture groups, and named groups. Free online regex tester — no signup needed.
/
/
How to Use
1
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).
2
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.
3
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
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. They are used to match, find, or replace text in strings. For example, /\d+/ matches one or more digits.
What are regex flags and what do they do?
Flags modify how a regex works. g (global) finds all matches, not just the first. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match line boundaries. s (dotAll) makes . match newlines.
What are capture groups?
Capture groups (...) let you extract specific parts of a match. For example, /(\d{4})-(\d{2})-(\d{2})/ matches a date and captures year, month, and day in separate groups. Named groups use (?<name>...) syntax.
Why does my regex not find all matches?
Without the g (global) flag, the regex stops after the first match. Enable the g flag to find all occurrences. Also ensure you have not accidentally added anchors (^ or $) that restrict matching.
Is any data sent to a server?
No. All regex processing runs entirely in your browser using JavaScript's built-in RegExp engine. Your pattern and test string never leave your device.
完整指南:正则表达式测试工具
什么是正则表达式?
正则表达式(regex)描述文本模式,用于搜索、验证和转换文本。是表单验证、日志分析和数据管道文本转换的必备工具。
支持:捕获组、前瞻断言、后顾断言、反向引用和g、i、m标志。
如何使用
- 在顶部字段输入模式(不含分隔符)。
- 选择标志:g(全局)、i(不区分大小写)、m(多行)。
- 在文本区域输入测试文本——匹配项实时高亮显示。
- 在结果面板查看捕获组。
专业技巧
- 不需要引用组时使用非捕获组
(?:...)。 g标志查找所有匹配;不加则只返回第一个。- 验证邮箱请使用库——完整的邮箱正则表达式极其复杂。