regex-mastery

regex-mastery is a skill for Claude Code, Codex from alibaba/anolisa. It costs 60 tokens per session (3,690 once invoked), scanned A, original, Apache-2.0.

A guide to regular expressions, compact patterns used to find, check, extract, or replace text. It covers features such as lookarounds, named groups, and backreferences.

In plain words
What is it for?
Writing or debugging text patterns, validating input, extracting information, and performing search-and-replace operations.
Why use it?
It helps create patterns that match the intended text while avoiding unreadable expressions and slow matching.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument; mentions Codex; mentions Gemini CLI.

About the project

ANOLISA is a server-side operating layer for AI agent workloads that provides terminal access, token-saving tool-output compression, runtime controls, security, observability, skills, memory, and sandbox management. It is for running and supervising agents from a Linux terminal while retaining an existing shell, agent framework, and sandbox. The catalogue add-ons are components of its agent operating environment and workflows.

alibaba/anolisa · 618 stars · on GitHub · agentic-os.sh

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.

agentmods
npx agentmods add skills/alibaba/anolisa/regex-mastery
Any agent
npx skills add alibaba/anolisa --skill regex-mastery
Clone the repo
git clone --depth 1 https://github.com/alibaba/anolisa

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-mastery

README.md
[![agentmods](https://agentmods.dev/badge/skills/alibaba/anolisa/regex-mastery.svg)](https://agentmods.dev/skills/alibaba/anolisa/regex-mastery)
Your own site
<a href="https://agentmods.dev/skills/alibaba/anolisa/regex-mastery"><img src="https://agentmods.dev/badge/skills/alibaba/anolisa/regex-mastery.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,690 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00060 $0.03690
Opus 5 $0.00030 $0.01845
Sonnet 5 $0.00012 $0.00738
Haiku 4.5 $0.00006 $0.00369

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

Security

Grade A, and why

regex-mastery 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 6d 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.

src/os-skills/system-admin/regex-mastery/SKILL.md · 325 lines

How it starts

The opening of the file, as written. The whole thing — 325 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When this skill is activated, always start your first response with the 🧢 emoji.

Regex Mastery

Regular expressions are a compact language for describing text patterns, built into virtually every programming language and text processing tool. They power input validation, log parsing, data extraction, search-and-replace, and tokenization. Used well, a single regex can replace dozens of lines of string manipulation code. Used poorly, they become unreadable traps and can grind a server to a halt via catastrophic backtracking.


When to use this skill

Trigger this skill when the user:

  • Asks to write or explain a regular expression
  • Wants to validate input format (email, URL, phone number, date, credit card)
  • Needs to extract data from structured or semi-structured text (logs, CSV, HTML)
  • Uses regex terminology: lookahead, lookbehind, named group, capture group, backreference
  • Wants to debug a pattern that isn't matching as expected
  • Asks about regex flags (i, g, m, s, u, x)
  • Needs to replace text using capture groups or back-references

Do NOT trigger this skill for:

  • Full HTML/XML parsing (use a proper parser like DOMParser or BeautifulSoup instead)
  • Complex natural language processing where ML models are a better fit

Key principles

  1. Readability over cleverness - A regex that nobody can maintain is worse than a slightly longer explicit approach. Break complex patterns into commented steps or use the verbose (x) flag where supported. A named group costs nothing but pays dividends every time someone reads the pattern.
  2. Use named capture groups - (?<year>\d{4}) is self-documenting and immune to positional breakage when the pattern changes. Always prefer named groups over numbered groups for any regex that will be read or maintained by humans.
  3. Test edge cases relentlessly - Empty string, Unicode characters, very long input, malformed-but-close input (e.g., foo@bar for email), and adversarial input designed to trigger backtracking. A regex that passes your happy path but fails on a Unicode em-dash will cause production incidents.
  4. Avoid catastrophic backtracking - Nested quantifiers ((a+)+) and overlapping alternatives ((a|ab)+) cause exponential backtracking on non-matching input. Use atomic groups or possessive quantifiers where available, or restructure alternation so choices are mutually exclusive.
  5. Use the right tool - Regex is not always the answer. Parsing emails to RFC 5321 compliance requires a full parser. Parsing JSON, HTML, or XML requires a DOM/SAX parser. If a regex exceeds ~80 characters or requires >2 levels of nesting, pause and ask whether a small state machine or parser would be clearer.

Read the full file on GitHub · 325 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 325 lines · 60 tokens per session scan A 7b1a697142bb

Subscribe to this mod's changes

regex-mastery is a skill published in the GitHub repository alibaba/anolisa (618 stars, last pushed yesterday), licensed Apache-2.0. It adds 60 tokens to every session and 3,690 once invoked, about $0.0003 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-08-30.

Related

Other skills, from other repositories

attack-patterns-reference

Use when classifying a verified web or WordPress behavior and selecting a related validation skill.

uphiago/recon-skills · 23 tokens

beevibe-team-mesh-negotiation

Multi-round negotiation protocol — covers both initiator and peer roles. Use when about to call negotiate(), when receiving a intent block as a peer, or when receiving an 'escalated' sentinel from a blocked respondnegotiate. Covers proposal crafting, counter-strategy, deadlock detection, when to accept early…

beevibe-ai/beevibe · 112 tokens

beevibe-verify-pr

CI verification before marking a PR-bearing task done. Use BEFORE calling mcpbeevibeupdateprogress(done) on any session whose deliverable is a pull request — including the first dispatch (you opened the PR with gh pr create) and any revision dispatch (you pushed new commits to an existing PR). Watches the PR's…

beevibe-ai/beevibe · 172 tokens

beevibe-pre-task-setup

Cold-start git workspace setup for a fresh beevibe task. Use at the start of a session whose intent has a block but NO or block — i.e. the first dispatch of this task. Checks for an existing repo clone, pulls the base branch if present (clone if missing), prunes any per-task worktrees from earlier tasks whose work has…

beevibe-ai/beevibe · 198 tokens

beevibe-use-repo

You are the child agent inside a fresh Docker sandbox. Borrow the given GitHub repo, produce a real artifact for the goal, and export it. Do not review the repo. The proof is that it works.

beevibe-ai/beevibe · 50 tokens

shared-patterns

Provide reusable patterns for validation, error handling, scaffolding. Use for skill consistency.

athola/claude-night-market · 21 tokens