regex-tester正则表达式助手,支持匹配测试、提取所有匹配、分组捕获、文本替换及常用模式生成。
Install via ClawdBot CLI:
clawdbot install crossallen/regex-tester正则表达式测试与调试工具,帮助开发者快速验证正则表达式、提取匹配结果和执行替换操作。
提供便捷的正则表达式测试环境,帮助用户:
在以下情况下使用此技能:
测试正则表达式在目标文本中的匹配情况。
python3 script/main.py match "<正则>" "<文本>"
示例:
# 测试邮箱匹配
python3 script/main.py match "[\w.+-]+@[\w-]+\.[\w.-]+" "contact@example.com"
# 测试手机号匹配(中国大陆)
python3 script/main.py match "1[3-9]\d{9}" "13800138000"
获取文本中所有匹配正则表达式的内容。
python3 script/main.py findall "<正则>" "<文本>"
示例:
# 提取所有URL
python3 script/main.py findall "https?://\S+" "访问 https://example.com 和 http://test.org"
# 提取所有数字
python3 script/main.py findall "\d+" "价格: 99, 数量: 100, 总计: 9900"
查看正则表达式中的捕获分组内容。
python3 script/main.py groups "<正则>" "<文本>"
示例:
# 解析日志格式
python3 script/main.py groups "\[(.*?)\] \[(.*?)\] (.*)" "[2024-02-14] [INFO] 启动服务"
# 解析日期时间
python3 script/main.py groups "(\d{4})-(\d{2})-(\d{2})" "今天是2024-02-14"
使用正则表达式进行文本替换。
python3 script/main.py sub "<正则>" "<替换内容>" "<文本>"
示例:
# 隐藏手机号中间四位
python3 script/main.py sub "(\d{3})\d{4}(\d{4})" "\1****\2" "联系13800138000"
# 去除HTML标签
python3 script/main.py sub "<[^>]+>" "" "<p>你好<b>世界</b></p>"
生成常用场景的正则表达式模式。
python3 script/main.py pattern "<模式名称>"
支持的模式:
email - 邮箱地址phone - 中国手机号idcard - 中国身份证号ipv4 - IPv4地址url - URL地址date - 日期 (YYYY-MM-DD)time - 时间 (HH:MM:SS)chinese - 中文字符username - 用户名 (字母数字下划线)password - 密码 (至少8位,包含字母和数字)示例:
python3 script/main.py pattern email
python3 script/main.py pattern phone
| 参数 | 说明 |
|------|------|
| match | 测试基本匹配 |
| findall | 提取所有匹配 |
| groups | 查看分组捕获 |
| sub | 执行替换操作 |
| pattern | 生成常用模式 |
# 验证邮箱格式是否正确
python3 script/main.py match "[\w.+-]+@[\w-]+\.[\w.-]+" "user@company.com"
# 从日志中提取所有错误代码
python3 script/main.py findall "ERROR:\s*(\w+)" "$(cat error.log)"
# 提取Markdown中的链接
python3 script/main.py findall "\[([^\]]+)\]\(([^)]+)\)" "[首页](https://example.com)"
# 统一日期格式
python3 script/main.py sub "(\d{4})/(\d{2})/(\d{2})" "\1-\2-\3" "2024/02/14"
# 去除多余空格
python3 script/main.py sub "\s+" " " "你好 世界"
# 解析命令行参数
python3 script/main.py groups "--(\w+)=([^\s]+)" "--name=test --port=8080"
# 解析CSV格式
python3 script/main.py groups "([^,]+),([^,]+),([^,]+)" "张三,25,北京"
| 符号 | 说明 |
|------|------|
| . | 匹配任意字符(除换行) |
| \d | 匹配数字 |
| \w | 匹配字母数字下划线 |
| \s | 匹配空白字符 |
| ^ | 匹配行首 |
| $ | 匹配行尾 |
| * | 匹配0次或多次 |
| + | 匹配1次或多次 |
| ? | 匹配0次或1次 |
| {n} | 匹配n次 |
| {n,} | 匹配至少n次 |
| {n,m} | 匹配n到m次 |
| [abc] | 匹配a、b或c |
| [^abc] | 匹配非a、b、c的字符 |
| () | 捕获分组 |
| (?:) | 非捕获分组 |
| | | 或操作 |
. ^ $ * + ? { } [ ] \ | ( ). 时注意贪婪匹配,可用 .? 进行非贪婪匹配group(0) 是整个匹配结果regex-tester/
├── SKILL.md # 技能说明文档(本文件)
├── script/
│ └── main.py # 主程序
└── tests/ # 测试用例
Generated Mar 1, 2026
Developers use this skill to validate user input such as email addresses, phone numbers, and passwords in web applications. It helps ensure data integrity by testing regex patterns against sample inputs before implementation.
IT and DevOps teams apply the skill to extract error codes, timestamps, or specific events from system logs. This aids in debugging and monitoring by quickly parsing large log files with regex patterns.
Data scientists utilize the skill to clean and preprocess text data, such as removing HTML tags, standardizing date formats, or extracting numerical values from unstructured datasets for analysis.
Content managers and SEO specialists use it to find and replace URLs, format text, or extract metadata from web content. This streamlines content updates and improves search engine optimization efforts.
Quality assurance engineers integrate the skill into test scripts to verify text outputs, validate data formats, or simulate user inputs. It enhances automated testing by providing regex-based assertions.
Offer a free basic version with limited features, such as simple regex testing, and charge for advanced capabilities like batch processing, API access, or premium pattern libraries. This attracts individual developers and upsells to enterprises.
Sell licenses to businesses for internal use, including custom integrations, support, and training. Target industries like finance or healthcare where data validation and text processing are critical for compliance.
Provide the regex functionality via a cloud-based API, allowing developers to embed it into their applications without local installation. Monetize based on usage tiers, such as number of API calls or data volume processed.
💬 Integration Tip
Integrate this skill into CI/CD pipelines for automated testing or use it as a command-line tool in development environments to streamline regex debugging.
Extract text from PDFs with OCR support. Perfect for digitizing documents, processing invoices, or analyzing content. Zero dependencies required.
Fast local PDF parsing with PyMuPDF (fitz) for Markdown/JSON outputs and optional images/tables. Use when speed matters more than robustness, or as a fallback while heavier parsers are unavailable. Default to single-PDF parsing with per-document output folders.
Find, evaluate, and recommend ClawHub skills by need with quality filtering and preference learning.
Fetch full tweets, long tweets, quoted tweets, and X Articles from X/Twitter without login or API keys, using no dependencies and zero configuration.
Skill 查找器 | Skill Finder. 帮助发现和安装 ClawHub Skills | Discover and install ClawHub Skills. 回答'有什么技能可以X'、'找一个技能' | Answers 'what skill can X', 'find a skill'. 触发...
Generate QR codes from text or URL for mobile scanning.