regex-patterns

regex-patterns is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 137 tokens per session (3,284 once invoked), scanned A, original, MIT.

A practical guide to regular expressions, which are patterns used to find, extract, or validate text. It explains syntax, Unicode text, differences between programming-language implementations, and performance risks.

In plain words
What is it for?
Use it to write and debug text patterns, validate input, convert patterns between languages, handle Unicode, and check for backtracking or ReDoS risks.
Why use it?
It helps prevent patterns from behaving differently across languages, mishandling international text, or becoming dangerously slow when processing user input.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write and debug text patterns, validate input, convert patterns between languages, handle Unicode, and check for backtracking or ReDoS risks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/regex-patterns
Install

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.

Any agent
npx skills add cass-2003/local-workflow-skill --skill regex-patterns
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for regex-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/regex-patterns/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/regex-patterns)
Your own site
<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.

agentmods 80×15 button for regex-patterns

Your own site · 80×15
<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>
Per session 137 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,284 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00137 $0.03284
Opus 5 $0.00068 $0.01642
Sonnet 5 $0.00027 $0.00657
Haiku 4.5 $0.00014 $0.00328

Measured 7d ago against content hash e9a77e67086d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

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 7d 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.

skills/engineering-core/ours/regex-patterns/SKILL.md · 293 lines

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+)

Read the full file on GitHub · 293 lines

Changes

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.

  1. 7d ago First seen · 293 lines · 137 tokens per session scan A e9a77e67086d

Subscribe to this mod's changes

regex-patterns is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 137 tokens to every session and 3,284 once invoked, about $0.0007 per session on Opus 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.

Related

Other skills, from other repositories

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

diagnose

Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.

emdash-cms/emdash · 43 tokens

repro-admin

Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.

emdash-cms/emdash · 48 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

byted-util-volcengine-detect-retry

An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.

bytedance/agentkit-samples · 101 tokens