affaan-m avatar

Regex Vs Llm Structured Text

This is the sensible middle ground between overengineered regex and expensive LLM calls for every parsing task. Use regex to handle the 95-98% of structured text that follows a pattern, add confidence scoring to flag edge cases, then only call an LLM for the 2-5% that need it. The production metrics are honest: 410 quiz items parsed with 8 low-confidence flags and roughly 5 LLM calls needed, saving 95% vs an all-LLM approach. The architecture is clean, the code samples are immutable and testable, and the decision framework actually helps you pick the right tool. If you're parsing invoices, forms, or any repeating structure where cost matters, this is worth your time.

skills.sh installs
5.1K
GitHub stars
229.1K
last updated
Jul 14, 2026

Install

$ npx -y skills add affaan-m/everything-claude-code --skill regex-vs-llm-structured-text --agent claude-code

Installs into .claude/skills of the current project.

Files

Regex vs LLM for Structured Text Parsing

A practical decision framework for parsing structured text (quizzes, forms, invoices, documents). The key insight: regex handles 95-98% of cases cheaply and deterministically. Reserve expensive LLM calls for the remaining edge cases.

When to Activate

  • Parsing structured text with repeating patterns (questions, forms, tables)
  • Deciding between regex and LLM for text extraction
  • Building hybrid pipelines that combine both approaches
  • Optimizing cost/accuracy tradeoffs in text processing

Decision Framework

Is the text format consistent and repeating?
├── Yes (>90% follows a pattern) → Start with Regex
│   ├── Regex handles 95%+ → Done, no LLM needed
│   └── Regex handles <95% → Add LLM for edge cases only
└── No (free-form, highly variable) → Use LLM directly

Architecture Pattern

Sponsors

Details

Repository
github.com/affaan-m/everything-claude-code
Category
AI & Agent Building

More from affaan-m/everything-claude-code

All 256
1conorbronsdon avataravoid-ai-writingconorbronsdon/avoid-ai-writingAudit and rewrite content to remove AI writing patterns ("AI-isms"). Use this skill when asked to "remove AI-isms," "clean up AI writing," "edit writing for AI 5.1Kskills.sh installs
2affaan-m avatarcontinuous-agent-loopaffaan-m/everything-claude-codecontinuous agent loop5Kskills.sh installs
3stablyai avataragent-slackstablyai/agent-slackSlack CLI for agents: read URLs/threads/history/unreads/later/canvases/workflows, create canvases from Markdown, search messages/files, download attachments, lo4.8Kskills.sh installs
4affaan-m avatarai-regression-testingaffaan-m/everything-claude-codeai regression testing4.8Kskills.sh installs
5affaan-m avatardata-scraper-agentaffaan-m/everything-claude-codedata scraper agent4.7Kskills.sh installs
6skillsh avataragent-toolsskillsh/skills4.7Kskills.sh installs