Skip to main content

regex-tester

Validate, test, and debug regular expressions by executing them against sample inputs. Use when asked to build, verify, or explain a regex pattern.

来源信息

仓库
microsoft/agent-framework
最近来源活动
2026年5月19日 15:49
检测到的 SKILL.md 语言
英语
星标
13,948
分支
2,427

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
regex-tester
description
Validate, test, and debug regular expressions by executing them against sample inputs. Use when asked to build, verify, or explain a regex pattern.
## Usage When the user asks you to create, validate, or debug a regular expression: 1. **Understand the requirement** — clarify what the pattern should match and what it should reject. 2. **Consult the cheatsheet** — review `references/regex-cheatsheet.md` for syntax reminders if needed. 3. **Write and execute test code** — use the `execute_code` tool to run Python code that: - Compiles the regex with `re.compile()` - Tests it against a set of positive examples (should match) and negative examples (should not match) - Extracts and displays any capturing groups - Reports pass/fail for each test case 4. **Iterate** — if any test fails, refine the pattern and re-run until all cases pass. 5. **Present the result** — give the user the final pattern, explain what each part does, and show the test results. ## Example Test Script ```python import re pattern = re.compile(r'^[\w.+-]+@[\w-]+\.[\w.-]+$') positives = ["user@example.com", "first.last+tag@sub.domain.org"] negatives = ["@missing.com", "no-at-sign", "spaces in@address.com"] for s in positives: assert pattern.match(s), f"FAIL: expected match for '{s}'" for s in negatives: assert not pattern.match(s), f"FAIL: expected no match for '{s}'" print("All tests passed!") ```
在 GitHub 查看