360 Secure SkillHub
360 安全技能中心

Rxtool

基于 Python 的零依赖命令行工具,通过子命令完成正则匹配测试、提取(支持 JSON 输出)、替换、按模式拆分,并解释正则各组成部分;支持命名分组以及大小写不敏感、多行、点号匹配换行等标志,文本可来自命令行参数或标准输入。

rogue-agent1
rogue-agent1
热度 46.37
最近更新 2026-05-11 17:37:31
分类:效率依赖:代码执行应用场景:数据处理

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add rxtool
Metadata
name
rxtool
description
Test, extract, replace, split, and explain regular expressions. Use when asked to test a regex pattern, extract matches from text, do regex replacements, split text by pattern, or understand what a regex does. Supports named groups, case-insensitive/multiline/dotall flags, and JSON output. Works with stdin pipes or inline text. Zero dependencies.

rxtool 🔤

Regex Swiss army knife — test, extract, replace, split, explain.

Commands

# Test a pattern against text
python3 scripts/rxtool.py test '(\d+)-(\d+)' "order-123-456"

# Extract all matches
python3 scripts/rxtool.py extract '\b\w+@\w+\.\w+\b' "email me at user@example.com"

# Extract with JSON output
echo "text" | python3 scripts/rxtool.py extract '\w+' --json

# Replace matches
python3 scripts/rxtool.py replace '\d+' 'NUM' "got 42 items and 7 boxes"

# Split by pattern
python3 scripts/rxtool.py split '[,;\s]+' "a, b; c d"

# Explain a regex
python3 scripts/rxtool.py explain '(?P<year>\d{4})-(?P<month>\d{2})'

Features

  • Group capture (numbered and named)
  • Case-insensitive (-i), multiline (-m), dotall (-s) flags
  • Stdin pipe support
  • JSON output for extraction
  • Regex explanation with component breakdown