🔍 测试面板

📐 使用说明与演算示例

演算示例:匹配邮箱地址 正则:(\w+)@(\w+\.\w+)
测试文本:Contact us: [email protected]
结果:匹配到 "[email protected]"
捕获组1:support(用户名)
捕获组2:easycalc.com(域名)
* 括号 () 定义捕获组,可在结果中查看每组的具体内容。

💡 如何使用本工具?

在"正则表达式"输入框中填写正则模式,在"测试文本"中填写待匹配的文本,匹配结果会实时显示在下方。可通过复选框启用全局(g)、忽略大小写(i)、多行(m)等标志位。

💡 如何查看捕获组?

在正则中使用括号 () 定义捕获组。匹配成功后,结果下方会以表格形式列出每个捕获组对应的文本内容。

💡 正则语法有误怎么办?

如果正则表达式存在语法错误,输入框下方会显示具体的错误提示,帮助你快速定位问题。

💡 常用正则速查

邮箱:\w+@\w+\.\w+
手机号:1[3-9]\d{9}
网址:https?://[\w./]+
中文:[\u4e00-\u9fa5]+

🔍 Test Panel

📐 Notes & Examples

Example: Match Email Addresses Regex: (\w+)@(\w+\.\w+)
Test Text: Contact us: [email protected]
Result: Matches "[email protected]"
Group 1: support (username)
Group 2: easycalc.com (domain)

💡 How to use this tool?

Enter your regex pattern in the top input and test text below. Results update in real time. Use the checkboxes to enable flags like global (g), case‑insensitive (i), and multiline (m).

💡 How to view capture groups?

Use parentheses () in your regex to define capture groups. After matching, a table below each match displays the content of each group.

💡 What if my regex has a syntax error?

If the regex is invalid, an error message will appear below the regex input to help you quickly locate the issue.

💡 Common Regex Patterns

Email: \w+@\w+\.\w+
Phone (US): \d{3}-\d{4}
URL: https?://[\w./]+
Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}