affaan-m avatar

Regex Vs Llm Structured Text

This is the hybrid parsing strategy you wish someone had told you about earlier. Use regex to handle the 95-98% of structured text that follows predictable patterns (quiz questions, forms, invoices), then add confidence scoring to flag the edge cases, and only call an LLM for those low-confidence extractions. The source shows real production metrics: 410 quiz items parsed, only 8 flagged for LLM review, 95% cost savings versus sending everything to Claude. The key insight is that regex is deterministic and nearly free, so you should always try it first and treat LLM calls as expensive exception handling rather than your primary parser.

skills.sh installs
5.5K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --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/ecc
Categories
Backend & APIs, AI & Agent Building, Productivity & Planning
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1affaan-m avatarhomelab-wireguard-vpnaffaan-m/eccWireGuard VPN server setup, peer configuration, key generation, split tunneling vs full tunnel routing, and remote access to a home network from mobile and lapt5.5Kskills.sh installs
2affaan-m avatarclickhouse-ioaffaan-m/eccClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.5.5Kskills.sh installs
3trailofbits avatarburpsuite-project-parsertrailofbits/skillsSearches and explores Burp Suite project files (.burp) from the command line. Use when searching response headers or bodies with regex patterns, extracting secu5.4Kskills.sh installs
4affaan-m avatarhomelab-vlan-segmentationaffaan-m/eccSegmenting home networks into VLANs for IoT, guest, trusted, and server traffic using UniFi, pfSense/OPNsense, and MikroTik — including switch trunk config, fir5.4Kskills.sh installs
5grafana avatarassistant-mcpgrafana/skillsConnect AI coding agents (Claude Code, Cursor, VS Code, OpenAI Codex) to Grafana Cloud via the `mcp-grafana` Model Context Protocol server. Installs the server 5.4Kskills.sh installs
6affaan-m avatarquarkus-tddaffaan-m/eccTest-driven development for Quarkus 3.x LTS using JUnit 5, Mockito, REST Assured, Camel testing, and JaCoCo. Use when adding features, fixing bugs, or refactori5.4Kskills.sh installs