Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问clear审计通过

regex-log正则表达式日志

Agent Skill

regex-log 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

808

周安装

33

GitHub Stars

93

下载量

259
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:regex-log(正则表达式日志)
来源仓库:https://github.com/letta-ai/skills
仓库路径:skills/regex-log
安装命令:
npx skills add https://github.com/letta-ai/skills --skill regex-log
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/letta-ai/skills --skill regex-log

简介

regex-log 用于日志条目解析,适合在 Codex、Claude、Cursor、Gemini CLI 中需要提取错误码、时间戳或事件类型时使用。

  • 它能将非结构化日志转为结构化数据。
  • 可通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 需适配不同日志格式,避免误匹配无关字段。
  • regex-log 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Regex Log Parsing Skill

This skill provides a systematic approach for constructing complex regular expressions that extract and validate structured data from log files.

When to Use This Skill

This skill applies when:

  • Building regex patterns to extract data from log entries
  • Validating specific formats (IPv4 addresses, dates, timestamps) within logs
  • Handling requirements for first/last occurrence selection
  • Enforcing word boundary conditions
  • Combining multiple validation constraints in a single pattern

Approach: Decomposition Strategy

Complex log parsing regex should be built by decomposing the problem into sub-patterns:

Step 1: Identify All Requirements

Before writing any regex, create a complete list of requirements:

  • What data needs to be validated (present but not captured)?
  • What data needs to be captured?
  • What boundary conditions apply (word boundaries, line anchors)?
  • Are there positional requirements (first, last, nth occurrence)?
  • What constitutes an invalid match?

Step 2: Build Sub-Patterns Independently

Construct each validation pattern separately before combining:

IPv4 Address Pattern

For valid IPv4 addresses (0-255 per octet, no leading zeros except for 0 itself):

  • Octet pattern: (?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])
  • Order alternatives from most specific to least specific
  • Full IPv4: (?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])

Date Pattern (YYYY-MM-DD)

For valid dates with proper month-day validation:

  • 31-day months: (?:0[13578]|1[02])-(?:0[1-9]|[12][0-9]|3[01])
  • 30-day months: (?:0[469]|11)-(?:0[1-9]|[12][0-9]|30)
  • February (up to 29): 02-(?:0[1-9]|1[0-9]|2[0-9])
  • Combine with year: [0-9]{4}-(?:...combined month-day patterns...)

Step 3: Apply Positional Requirements

Selecting Last Occurrence

To capture the last valid pattern in a line:

^.*<pattern>(?!.*<pattern>)
  • Use ^.* to greedily consume characters
  • Use negative lookahead (?!.*<pattern>) to ensure no pattern follows

Selecting First Occurrence

To capture the first valid pattern:

^(?:(?!<pattern>).)*<pattern>

Or simply rely on regex engines returning the first match by default.

Step 4: Apply Validation Without Capture

To require presence of a pattern without capturing it:

  • Use lookahead: (?=.*<pattern>) at the start of the regex
  • This validates the line contains the pattern without affecting the capture

Step 5: Apply Word Boundaries

For patterns that must not be adjacent to alphanumeric characters:

  • Use \b word boundaries: \b<pattern>\b
  • Be aware that \b matches between word and non-word characters

Verification Strategy

Create Comprehensive Test Cases

Organize tests by category:

  1. Valid cases: Confirm expected matches

- Minimum/maximum valid values (e.g., 0.0.0.0, 255.255.255.255) - Edge values for each component

  1. Invalid format cases: Confirm rejection

- Out-of-range values (e.g., 256.0.0.0) - Invalid formatting (leading zeros where prohibited) - Invalid months (00, 13) or days (32)

  1. Boundary condition cases:

- Pattern at start/end of line - Pattern adjacent to alphanumeric characters (should fail with word boundaries) - Pattern adjacent to punctuation (should pass with word boundaries)

  1. Positional cases:

- Multiple valid patterns in one line (verify correct one is captured) - Single pattern in line - No valid pattern in line

Test File Structure

Create a structured test file that:

  • Groups tests by category
  • Uses clear naming for each test case
  • Reports pass/fail status for each test
  • Summarizes overall results

Example structure:

test_cases = {
    "valid_ipv4": [...],
    "invalid_ipv4": [...],
    "valid_dates": [...],
    "invalid_dates": [...],
    "last_occurrence": [...],
    "boundary_conditions": [...]
}

Common Pitfalls

1. Incomplete First Attempt

  • Problem: Creating incomplete or truncated test files
  • Solution: Plan the full test structure before writing; validate file completeness before execution

2. Environment Assumptions

  • Problem: Assuming python command exists when only python3 is available
  • Solution: Check the Python environment first or use python3 explicitly

3. Scattered Reasoning

  • Problem: Disorganized thought process leading to repeated work
  • Solution: Follow the decomposition strategy linearly; complete each sub-pattern before moving to the next

4. Duplicate Patterns Without Abstraction

  • Problem: Same regex pattern repeated multiple times, increasing error risk
  • Solution: Define complex sub-patterns once in reasoning, then reference them; in code, use variables

5. Missing Edge Cases

  • Problem: Focusing only on happy path validation
  • Solution: Explicitly test:

- Boundary values (min/max for each component) - Invalid values just outside valid range - Empty and null cases - Patterns at different positions in the line

6. Order of Alternatives

  • Problem: Less specific alternatives matching before more specific ones
  • Solution: Order regex alternatives from most specific to least specific (e.g., 25[0-5] before 2[0-4][0-9] before [0-9])

7. Greedy vs Non-Greedy Matching

  • Problem: Unexpected capture due to greedy quantifiers
  • Solution: Understand when to use .* vs .*?; for "last occurrence" patterns, greedy .* is typically correct

Workflow Summary

  1. List all requirements explicitly
  2. Build and test sub-patterns independently
  3. Combine sub-patterns with appropriate anchors and lookaheads
  4. Create comprehensive test cases covering all categories
  5. Run tests and verify all pass
  6. Clean up test files after validation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.97%
按下载量换算70

Gemini CLI

22.01%
按下载量换算57

Antigravity

16.37%
按下载量换算42

windsurf

12.22%
按下载量换算32

OpenCode

8.44%
按下载量换算22

Codex

3.52%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills