一键导入
regex-tester
Create, test, and debug regular expressions. Use when user asks to write a regex, test a pattern against text, or debug why a regex isn't matching.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create, test, and debug regular expressions. Use when user asks to write a regex, test a pattern against text, or debug why a regex isn't matching.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
本地离线 OCR 文字识别,基于 tesseract.js。当用户发图片/截图/扫描件要求提取文字时使用,支持中英文。纯本地运行,无需联网。
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Use when implementing any feature or bugfix, before writing implementation code
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
| name | regex-tester |
| description | Create, test, and debug regular expressions. Use when user asks to write a regex, test a pattern against text, or debug why a regex isn't matching. |
| version | 1.0.0 |
| author | deskwand |
| license | MIT |
| metadata | {"tags":["Regex","Regular Expressions","Pattern","Matching","Text"]} |
| allowed-tools | read,shell,grep |
Create and test regular expressions interactively.
# Test if regex matches
echo "test string" | grep -oP 'pattern'
# Extract matches
echo "abc123def456" | grep -oP '\d+'
# Output:
# 123
# 456
# Count matches
echo "abc123def456ghi789" | grep -oP '\d+' | wc -l
# Show matching lines with context
grep -nP 'pattern' file.txt
| Pattern | Regex | Notes |
|---|---|---|
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ | Simplified; RFC 5322 is more complex | |
| URL | https?://[^\s/$.?#].[^\s]* | Basic; consider urllib.parse for robust parsing |
| IPv4 | ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ | Does not validate ranges (0-255) |
| Date (YYYY-MM-DD) | ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$ | Does not validate month-day combos |
| Phone (Chinese) | ^1[3-9]\d{9}$ | 11-digit mobile |
| SemVer | ^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$ |
| Pattern | Regex |
|---|---|
| Numbers | \d+ (integers), \d+\.\d+ (decimals) |
| Words | \b\w+\b |
| Quoted strings | "([^"]*)" or '([^']*)' |
| HTML tags | <(\w+)[^>]*>(.*?)</\1> |
| Markdown links | \[([^\]]+)\]\(([^)]+)\) |
| Hex color | #([0-9a-fA-F]{6}|[0-9a-fA-F]{3}) |
For complex regex debugging:
python3 -c "
import re
pattern = r'<your regex>'
tests = [
('should match', True),
('should not', False),
]
for text, expected in tests:
result = bool(re.search(pattern, text))
status = '✅' if result == expected else '❌'
print(f'{status} \"{text}\" -> {result} (expected {expected})')
"
| Element | Meaning |
|---|---|
. | Any character except newline |
* | 0 or more |
+ | 1 or more |
? | 0 or 1 |
{n} | Exactly n |
{n,} | n or more |
{n,m} | n to m |
^ | Start of string/line |
$ | End of string/line |
\b | Word boundary |
\d | Digit |
\w | Word character |
\s | Whitespace |
[abc] | Character class |
[^abc] | Negated class |
(a|b) | Alternation |
(...) | Capturing group |
(?:...) | Non-capturing group |
(?=...) | Lookahead |
(?<=...) | Lookbehind |
| Flag | Python | grep -P |
|---|---|---|
| Case-insensitive | re.IGNORECASE / (?i) | grep -iP |
| Multiline (^/$ match line boundaries) | re.MULTILINE / (?m) | N/A |
| Dot matches newline | re.DOTALL / (?s) | N/A |
.*? instead of .*^/$ anchors or word boundaries \b.*(.*)* — catastrophic backtracking risk