Regex Vs LLM Structured Text

在解析结构化文本时,用于在正则表达式(Regex)和大型语言模型(LLM)之间进行选择的决策框架——优先使用正则表达式,仅针对低置信度的边界情况引入 LLM。

2,037 stars 332 forksAI, LLMs & Agents Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add xu-xiang/everything-claude-code-zh

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add xu-xiang/everything-claude-code-zh --skill regex-vs-llm-structured-text
Manual install
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/skills/regex-vs-llm-structured-text ~/.claude/skills/regex-vs-llm-structured-text

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# 结构化文本解析:正则表达式(Regex)与大语言模型(LLM)的抉择

这是一个用于解析结构化文本(测验、表单、发票、文档)的实用决策框架。核心见解是:正则表达式(Regex)能以极低的成本确定性地处理 95-98% 的情况。应将昂贵的 LLM 调用保留给剩余的边界情况(Edge Cases)。

## 何时激活(When to Activate)

- 解析具有重复模式的结构化文本(问题、表单、表格等)
- 在文本提取任务中权衡使用正则表达式还是 LLM
- 构建结合这两种方法的混合流水线(Hybrid Pipelines)
- 在文本处理中优化成本与准确性的平衡

## 决策框架(Decision Framework)

```
文本格式是否一致且重复?
├── 是 (>90% 遵循某种模式) → 从正则表达式(Regex)开始
│   ├── 正则表达式处理了 95%+ → 完成,无需 LLM
│   └── 正则表达式处理率 <95% → 仅针对边界情况添加 LLM
└── 否 (非格式化,高度多变) → 直接使用 LLM
```

## 架构模式(Architecture Pattern)

```
源文本(Source Text)
    │
    ▼
[正则解析器 (Regex Parser)] ─── 提取结构 (95-98% 准确率)
    │
    ▼
[文本清洗器 (Text Cleaner)] ─── 去除噪声 (标记、页码、人工痕迹)
    │
    ▼
[置信度评分器 (Confidence Scorer)] ─── 标记低置信度提取结果
    │
    ├── 高置信度 (≥0.95) → 直接输出
    │
    └── 低置信度 (<0.95) → [LLM 验证器 (LLM Validator)] → 输出
```

## 实现参考(Implementation)

### 1. 正则解析器 (处理绝大多数情况)
Read the full skill on GitHub

Details

Skill name
regex-vs-llm-structured-text
Path
skills/regex-vs-llm-structured-text/SKILL.md
License
MIT
Repo updated
5 March 2026

FAQ

What does the Regex Vs LLM Structured Text skill do?

在解析结构化文本时,用于在正则表达式(Regex)和大型语言模型(LLM)之间进行选择的决策框架——优先使用正则表达式,仅针对低置信度的边界情况引入 LLM。

How do I install the Regex Vs LLM Structured Text skill?

Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Regex Vs LLM Structured Text popular?

It lives in xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.

Related skills

Backend Patterns

2k

xu-xiang/everything-claude-code-zh

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

Software Development332

Coding Standards

2k

xu-xiang/everything-claude-code-zh

Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.

Software Development332

Frontend Patterns

2k

xu-xiang/everything-claude-code-zh

Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.

Frontend & Design332

MCP Client

850

coleam00/second-brain-skills

Universal MCP client for connecting to any MCP server with progressive disclosure. Wraps MCP servers as skills to avoid context window bloat from tool definitions. Use when interacting with external MCP servers (Zapier, Sequential Thinking, GitHub, filesystem, etc.), listing available tools, or executing MCP tool calls. Triggers on requests like "connect to Zapier", "use MCP server", "list MCP tools", "call Zapier action", "use sequential thinking", or any MCP server interaction.

AI, LLMs & Agents216

Regex Vs LLM Structured Text

2k

xu-xiang/everything-claude-code-zh

选择在解析结构化文本时使用正则表达式还是大型语言模型的决策框架——从正则表达式开始,仅在低置信度的边缘情况下添加大型语言模型。

AI, LLMs & Agents332

Agentcore Register

1.1k

agentic-community/mcp-gateway-registry

Given an MCP server URL, probe the server via curl to discover its metadata and tools, then generate a markdown file with copy-pasteable content for each field in the Amazon Bedrock AgentCore "Create record" form.

AI, LLMs & Agents263

Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.