regex-builder
Skill0 starsChanged 5 months agoMITView on GitHub
Use when the user wants to build a regex from positive and negative examples rather than from a description. Triggers on "build a regex that matches X but not Y", "I have these examples that should match...", "I need a pattern that catches these but skips these", or when the user provides labeled examples and wants a working regex.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- mergisi/awesome-openclaw-agentstheir own version, first seen Nov 1, 2026
- poorvith-mp/skills-developertheir own version, first seen Aug 19, 2026
- ATOM00blue/agent-skills-protheir own version, first seen May 22, 2026
- kakarot-oncloud/claude-dev-skillstheir own version, first seen Apr 19, 2026
- jMerta/codex-skillstheir own version, first seen Dec 14, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- mergisi/awesome-openclaw-agents★ 4.1ksame name
- jMerta/codex-skills★ 130same name
- ATOM00blue/agent-skills-pro★ 0same name
- kakarot-oncloud/claude-dev-skills★ 0same name
- poorvith-mp/skills-developer★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- api-docs-from-openapiSkill
- changelog-writerSkill
- code-review-preflightSkill
- csv-cleanerSkill
- json-schema-from-sampleSkill
- meeting-notes-summarizerSkill
- sql-from-questionSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
If the user gives only positives, ask for negatives.
- Distinctive: line 20
Confirm the engine: Default to JavaScript / PCRE (they're nearly identical for most patterns).
- Very specific: line 21
Python
re: no possessive quantifiers, different lookbehind rules - Very specific: line 22
Go
regexp: no lookarounds, no backreferences (RE2) - Distinctive: line 25
If the user's environment isn't clear from context, ask.
- Distinctive: line 55
If any test fails, tighten and re-test.
- Very specific: line 65
MUST NOT: use overly complex constructs when simple ones suffice.
- Very specific: line 66
MUST NOT: use catastrophic-backtracking patterns.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Regex Builder
Build a regex from examples. Validate against the user's data before claiming it works.
Process
Get the examples. Need both:
- Positives: strings that MUST match
- Negatives: strings that MUST NOT match
If the user gives only positives, ask for negatives. Without negatives, the regex
.*matches everything; the negatives are what shape the pattern.Aim for at least 5 positives and 5 negatives. If fewer, warn the user that the regex may be over-fit.
Confirm the engine. Default to JavaScript / PCRE (they're nearly identical for most patterns). Other engines have important differences:
- Python
re: no possessive quantifiers, different lookbehind rules - Go
regexp: no lookarounds, no backreferences (RE2) - POSIX: no
\d,\w,\sshortcuts
If the user's environment isn't clear from context, ask.
- Python
- Look at the positives. Identify common structure:
- Anchors needed? (Does match start at beginning, end at end, or float?)
- Fixed prefixes/suffixes
- Variable parts: are they alphanumeric, digits only, contain specific characters?
- Length: fixed, range, or unbounded?
- Check the negatives. Identify what must NOT be allowed:
- Different prefix? Use lookahead negation.
- Different content type? Tighten character class.
- Different length? Use quantifier bounds.
- Build incrementally. Start permissive, add constraints.
- First pass: matches all positives but might match some negatives
- Each iteration: identify which negatives still match and tighten
Test against EVERY positive and EVERY negative. Report results in a table:
POSITIVE EXPECTED GOT abc-123 match match OK abc-456 match match OK ... NEGATIVE EXPECTED GOT abc-12 no-match no-match OK abcd-123 no-match match FAIL -- pattern is too loose, fixingIf any test fails, tighten and re-test. Don't deliver a pattern that fails any provided example.
- Output:
- The pattern (with delimiters appropriate to the engine)
- A plain-English explanation of each part
- A note about what the pattern does NOT enforce (e.g. "doesn't validate that the date is a real calendar date, only that the format is correct")
- The example test results table
What NOT to do
- MUST NOT use overly complex constructs when simple ones suffice.
[A-Za-z0-9]beats[\w&&[^_]]for readability. - MUST NOT use catastrophic-backtracking patterns. Avoid nested quantifiers like
(a+)+or(a|a)+. - MUST NOT assume word boundary
\bdoes what the user wants without testing --\bbehaves differently around non-ASCII characters. - MUST NOT silently choose case-insensitive matching unless the examples make it obvious. If "ABC" is positive and "abc" is negative, casing matters; preserve it.
Edge cases
- Examples are URLs / emails / phone numbers: standard regexes for these are well-known. Suggest the standard pattern AND the user's example-derived pattern; let them pick.
- Examples have invisible characters (zero-width spaces, non-breaking spaces): flag this; show hex of suspicious whitespace.
- Examples vary widely: maybe regex isn't the right tool. Suggest alternative parsing.
- Negative examples are subsets of positive examples (impossible): tell the user the constraints conflict.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

