360 Secure SkillHub
360 安全技能中心

Regexpal

这是一款终端正则工具,核心功能包括测试正则与文本的匹配、在文件中查找并高亮匹配内容、批量替换文本、提取捕获组,还能解释正则语法。适用于开发者调试正则、验证格式、处理文本文件等场景,通过终端命令传参操作,输出清晰结果,依赖Python3运行。

xueyetianya
xueyetianya
热度 65.48
最近更新 2026-05-11 17:31:53
分类:开发依赖:代码执行 / 读写文件应用场景:调试排错 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add regexpal
Metadata
name
RegexPal
description
Test and debug regex patterns against sample text. Use when checking match groups, validating patterns, generating replacements, linting syntax.
version
3.0.0
author
BytesAgain
homepage
https://bytesagain.com
source
https://github.com/bytesagain/ai-skills
tags
["regex","regular-expression","pattern","matcher","tester","developer","text"]
categories
["Developer Tools","Utility"]

RegexPal

A real regex tester and toolkit for the terminal. Test patterns against text, find matches in files with highlighted output, perform replacements, extract capturing groups, and get human-readable explanations of regex syntax.

Commands

Command Description
regexpal test <pattern> <text> Test if a regex matches text — reports full match, partial match, groups, and named groups
regexpal match <pattern> <file> Find all matches in a file — highlights matches in red, shows line numbers and match count
regexpal replace <pattern> <replacement> <file> Replace all matches in a file and output to stdout. Supports backreferences (\1, \2)
regexpal extract <pattern> <file> Extract capturing groups from all matches in a file — shows each group value per match
regexpal explain <pattern> Break down a regex pattern — lists character classes, groups, tokens, and quantifiers

Requirements

  • python3 (uses re stdlib module)

Examples

# Test a pattern
regexpal test '^\d{3}-\d{4}$' '123-4567'

# Find emails in a file
regexpal match '\w+@[\w.-]+' contacts.txt

# Replace version numbers
regexpal replace 'v(\d+)\.(\d+)' 'v\1.$((\\2+1))' changelog.md

# Extract domain parts from emails
regexpal extract '(\w+)@(\w+\.\w+)' emails.txt

# Understand a complex pattern
regexpal explain '(?<=@)[\w.-]+'