Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add cass-2003/local-workflow-skill --skill regex-patternsgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cass-2003/local-workflow-skill/regex-patterns)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/regex-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/regex-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/regex-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/regex-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00137 | $0.03284 |
| Opus 5.5 | $0.00055 | $0.01314 |
| Sonnet 5.5 | $0.00027 | $0.00657 |
| Haiku 4.5 | $0.00014 | $0.00328 |
Grade A, and why
regex-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 293 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Regex Patterns Skill — 正则实战
何时使用
- 写或调试正则
- 性能问题:CPU 跑满 / ReDoS 攻击
- 跨语言移植正则(JS → Python → Go)发现行为不一致
- 处理 Unicode 文本(中日韩 / emoji / 组合字符)
- 评审用户输入校验是否安全(catastrophic backtracking)
一、语法速查
字符类
| 符号 | 含义 |
|---|---|
. |
任意字符(默认不含 \n,加 s 标志含) |
\d \D |
数字 / 非数字 |
\w \W |
单词字符(字母数字下划线)/ 非 |
\s \S |
空白 / 非空白 |
[abc] [^abc] |
集合 / 反集合 |
[a-z] |
范围 |
\b \B |
单词边界 / 非边界 |
\p{L} \p{N} \p{Han} |
Unicode 类别(必须 u 标志) |
量词
| 符号 | 含义 |
|---|---|
* |
0+ |
+ |
1+ |
? |
0 或 1 |
{n} |
恰好 n |
{n,} |
至少 n |
{n,m} |
n 到 m |
后接 ? |
惰性(最少匹配):.*? |
后接 + |
独占(不回溯,PCRE/Java/Ruby 支持,JS 不支持):.*+ |
锚点 / 边界
| 符号 | 含义 |
|---|---|
^ |
行首(m 标志下每行;否则字符串首) |
$ |
行尾 |
\A \z |
字符串开始 / 结束(不受 m 影响,JS 不支持) |
\b |
单词边界 |
分组
(abc) 捕获组 #1
(?:abc) 非捕获组(性能更好)
(?<name>abc) 命名捕获组
\1 反向引用第 1 组
\k<name> 反向引用命名组
标志(flag)
| 标志 | 含义 |
|---|---|
i |
大小写不敏感 |
g |
全局(JS / 部分语言) |
m |
多行(影响 ^ $) |
s |
单行(让 . 匹配 \n) |
u |
Unicode(启用 \p{}、4 字节 emoji 等) |
x |
扩展(忽略空白和注释,便于多行写) |
y |
sticky(JS)— 从 lastIndex 严格匹配 |
二、Lookaround(零宽断言)
不消耗字符,仅断言位置。
| 语法 | 含义 |
|---|---|
(?=...) |
后面是 ... |
(?!...) |
后面不是 ... |
(?<=...) |
前面是 ... |
(?<!...) |
前面不是 ... |
例子:
# 提取价格数字(前面有 $ 符)
(?<=\$)\d+(?:\.\d+)?
# 密码至少有 1 大写 + 1 数字 + 长度 8+
^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$
# 不是 .png 结尾的文件
^.+(?<!\.png)$
JavaScript / Python / .NET / PCRE / Java 都支持 lookaround。Go 的 RE2 不支持。
三、Unicode 模式(u 标志)
# 不加 u:只能匹配 ASCII
/\w+/.test('café') // true,但只匹配 'caf','é' 不算
/^.$/u.test('🎉') // true(u 标志下识别为单字符)
# 类别匹配
/\p{Letter}+/u // 任何语言字母(拉丁/中文/阿拉伯/...)
/\p{Han}+/u // 中文汉字
/\p{Emoji}/u // emoji
/\p{Script=Hiragana}/u // 平假名
/\p{Script=Katakana}/u // 片假名
/\p{Script=Hangul}/u // 韩文
# 现代 emoji(含 ZWJ 序列、肤色变体)
/\p{RGI_Emoji}/v // v 标志(更新的 Unicode 引擎,2023+)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 293 lines · 137 tokens per session scan A e9a77e67086d
regex-patterns is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 4mo ago), licensed MIT. It adds 137 tokens to every session and 3,284 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
regex-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| regex-patternscass-2003/local-workflow-skill | Skill | 12 | 4mo ago | MIT | A | 137 | Claude Code, Codex |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | today | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | today | MIT | A | 71 | Claude Code, Codex |
| observability-audit-sessionsIBM/mcp-context-forge | Skill | 4.9k | today | Apache-2.0 | A | 64 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 343 | today | Apache-2.0 | A | 112 | Claude Code |
| performance-verificationvalkor-ai/loom | Skill | 1.6k | 2d ago | Apache-2.0 | A | 45 | Claude Code, Codex |
| loop-engineeringhuytieu/COG-second-brain | Skill | 1.6k | today | MIT | A | 63 | Claude Code |