Regex Playground
Interactive regular expression learning and testing tool.
Usage
CODEBLOCK0
Features
- - 🎯 Real-time matching
- 📖 Plain English explanation
- 🔍 Match groups extraction
- 📋 Common patterns library
- 🧪 Test cases generator
Example
CODEBLOCK1
Common Patterns
| Pattern | Meaning | Example |
|---|
| INLINECODE0 | One or more digits | 123 |
| INLINECODE1 |
Word characters | hello_123 |
|
[a-z] | Letter range | a, b, c |
|
^start | Starts with | start... |
|
end$ | Ends with | ...end |
|
a|b | OR | a or b |
|
a* | Zero or more a | '', a, aaa |
|
a+ | One or more a | a, aaa |
Commands
- -
regex explain <pattern> - Explain pattern in plain English - INLINECODE9 - Test pattern against string
- INLINECODE10 - Show common patterns
- INLINECODE11 - Generate test cases (email, url, phone, etc.)
Use Cases
- - Debug regex in code
- Learn regex by seeing matches
- Validate input patterns
- Extract data from strings
Regex Playground
交互式正则表达式学习与测试工具。
使用方法
regex 模式 测试字符串
功能特性
- - 🎯 实时匹配
- 📖 通俗易懂的英文解释
- 🔍 匹配组提取
- 📋 常用模式库
- 🧪 测试用例生成器
示例
输入: regex (\w+)@(\w+)\.(\w+) test@example.com
输出:
✓ 匹配: test@example.com
组1: test
组2: example
组3: com
解释:
- - (\w+) - 捕获单词字符 (test)
- @ - 字面量 @
- (\w+) - 捕获单词字符 (example)
- \. - 字面量点号
- (\w+) - 捕获单词字符 (com)
常用模式
单词字符 | hello_123 |
| [a-z] | 字母范围 | a, b, c |
| ^start | 以...开头 | start... |
| end$ | 以...结尾 | ...end |
| a|b | 或 | a 或 b |
| a* | 零个或多个 a | , a, aaa |
| a+ | 一个或多个 a | a, aaa |
命令
- - regex explain <模式> - 用通俗英语解释模式
- regex test <模式> <字符串> - 测试模式与字符串的匹配
- regex library - 显示常用模式
- regex generate <类型> - 生成测试用例(邮箱、网址、电话等)
使用场景
- - 调试代码中的正则表达式
- 通过查看匹配结果学习正则表达式
- 验证输入模式
- 从字符串中提取数据