Regex logo

Regex

Community
0xBakeer
regex

Writing and testing regular expressions in Python and JavaScript - anchors, groups, character classes, greedy versus lazy, multiline flags, named groups, and testing against positive and negative examples before use.

Overview

Publisher0xBakeer
RepositoryTandemLLM
Skill nameregex
Stars
75
Forks
14
Bundled files
Instructions only
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by 0xBakeer on GitHub. Read the source before you install it.

Installation

Install the Regex AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/regex
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/0xBakeer/TandemLLM.git /tmp/TandemLLM
mkdir -p .claude/skills
cp -r /tmp/TandemLLM/packages/library/regex .claude/skills/regex
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Regex in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Regex on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Regex is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Regular expressions

Rules:

  • Write the examples first: 5 strings that must match, 5 that must not, including the edges (empty, unicode, extra spaces). Test the pattern against them before using it.
  • Anchor what should be whole: ^...$ (with re.fullmatch in Python). Escape literals: \., \(, \?.
  • Named groups (?P<year>\d{4}) (Python) or (?<year>\d{4}) (JS). Non-capturing (?:...) for grouping only.
  • Lazy .*? for "up to the next X" inside a line; better: a negated class [^"]*.
  • Flags on purpose: re.I, re.M (anchors per line), re.S (dot matches newline), re.X for a commented pattern over 40 characters.

What goes wrong:

  • .* swallows the rest of the line; two fields merge.
  • \d matches Arabic-Indic digits in Python 3 str mode; use [0-9] when ASCII is meant.
  • Catastrophic backtracking from (a+)+ or (.*,)* on a long non-matching input; test on a 10k-character miss.

Check: run the positive and negative examples through the pattern and print a table of expected and actual; time one long non-matching input (under 10 ms).

Done when:

  • The example table (10 cases, expected vs actual) in the result, all equal.
  • Timing of the pattern on a 10k-character non-matching string under 10 ms.
  • Each capture group named and shown on one real input.

Reference

Python harness:

python
import re, time
PAT = re.compile(r"""^(?P<user>[\w.+-]+)@(?P<host>[\w-]+(?:\.[\w-]+)+)$""", re.X)
yes = ["a@b.io", "first.last+tag@sub.example.com", "x_y@h-h.de", "A@B.CO", "1@2.3x"]
no = ["", "a@b", "@b.io", "a b@c.io", "a@b..io"]
for s, exp in [(s, True) for s in yes] + [(s, False) for s in no]:
    got = PAT.fullmatch(s) is not None
    print(f"{s!r:40} expected={exp} got={got} {'OK' if exp == got else 'FAIL'}")
m = PAT.fullmatch("first.last+tag@sub.example.com"); print(m.groupdict())
t0 = time.perf_counter(); PAT.fullmatch("a" * 10000 + "@" + "b" * 10000); print(f"{(time.perf_counter()-t0)*1000:.2f} ms")

Common pieces: ISO date (?P<y>\d{4})-(?P<m>0[1-9]|1[0-2])-(?P<d>0[1-9]|[12]\d|3[01]); key=value lines ^(?P<k>[^=\s]+)\s*=\s*(?P<v>.*)$ with re.M; quoted string "(?P<s>(?:[^"\\]|\\.)*)"; whole words \bword\b. Replace with a function: re.sub(r"\d+", lambda m: str(int(m.group()) * 2), text). JS: const m = s.match(/^(?<y>\d{4})-(?<m>\d{2})$/); m?.groups.y; all matches: [...s.matchAll(/\d+/g)].map(m => m[0]). Split on a pattern: re.split(r"[,;]\s*", s). Find all non-overlapping: re.findall(r"\w+", s).

More rules:

  • A regex is not a parser: HTML, JSON, CSV with quotes, nested brackets get a real parser.

More pitfalls:

  • Forgetting raw strings in Python ("\d" is fine, "\b" is a backspace); always r"...".
  • JS g flag keeps lastIndex across .test() calls; use match/matchAll or reset.

Frequently asked questions

What does the Regex AI skill do?

Writing and testing regular expressions in Python and JavaScript - anchors, groups, character classes, greedy versus lazy, multiline flags, named groups, and testing against positive and negative examples before use.

Why use Regex on TypingMind?

Because you install it once and use it with any model. Regex is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Regex in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/regex. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Regex?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Regex?

As many as you like. As long as a model supports skills, you can use Regex with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Regex AI skill free?

Yes. It is published on GitHub by 0xBakeer under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇