← 返回
未分类 中文

Regex Toolkit

Test, match, extract, replace, explain, and validate regular expressions from the command line. Includes a library of 25+ common patterns (email, URL, IP, ph...
在命令行中测试、匹配、提取、替换、解释并验证正则表达式,包含25+常见模式库(邮件、URL、IP、电话等)。
johnnywang2001 johnnywang2001 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 447
下载
💾 0
安装
1
版本
#latest

概述

Regex Toolkit

Test, find, replace, explain, and validate regular expressions. Includes 25+ common named patterns. Pure Python, no dependencies.

Quick Start

# Test a pattern
python3 scripts/regex_toolkit.py test '\d+' --text 'abc 123 def'

# Use a named pattern (email, url, ipv4, phone-us, uuid, etc.)
python3 scripts/regex_toolkit.py findall email --text 'Contact hello@example.com or support@test.org'

# Find all matches with positions
python3 scripts/regex_toolkit.py findall '\b\w{5}\b' --file input.txt

# Search and replace
python3 scripts/regex_toolkit.py replace '\bfoo\b' -r bar --text 'foo bar foo'

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

# Validate regex syntax
python3 scripts/regex_toolkit.py validate '[a-z'

# List all common patterns
python3 scripts/regex_toolkit.py patterns --list

# Pipe from stdin
echo "Call 555-1234 or 555-5678" | python3 scripts/regex_toolkit.py findall phone-us

Commands

CommandDescription
----------------------
testCheck if pattern matches. Shows first match position and groups.
findallFind all matches with positions and captured groups. --json for JSON output.
replaceRegex search-and-replace. Supports \1 backreferences. --count N limits replacements.
explainBreak down a regex into plain-English explanation of each element.
validateCheck if a regex pattern is syntactically valid.
patternsList built-in common patterns or show a specific one by name.

Input Options

All matching commands accept: --text 'string', --file path, or piped stdin.

Flags

FlagDescription
-------------------
-i, --ignorecaseCase-insensitive matching
-m, --multiline^/$ match line boundaries
-s, --dotall. matches newline

Built-in Patterns

Use by name instead of writing regex: email, url, ipv4, ipv6, phone-us, phone-intl, date-iso, date-us, time-24h, hex-color, mac-address, uuid, ssn, zip-us, credit-card, slug, semver, domain, hashtag, mention, markdown-link, html-tag, json-key, filepath-unix, filepath-win.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 02:29 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Subdomain Enum

johnnywang2001
通过DNS暴力破解和证书透明度日志(crt.sh)枚举任意域的子域名。适用于用户需要发现子域名、执行侦察等场景。
★ 0 📥 638
productivity

Agent Invoice Generator

johnnywang2001
根据自然语言或结构化数据生成专业的PDF发票,适用于用户请求创建发票、向客户计费或生成收据等场景。
★ 0 📥 673
developer-tools

Sitemap Generator

johnnywang2001
通过爬取网站生成 XML 网站地图。适用于创建 sitemap.xml(SEO),审计站点结构,发现域名下所有页面等场景。
★ 0 📥 632