Permission Setup Review
python scripts/_setup_logs.py is an optional setup helper for the Regex Toolkit skill. It may apply broad filesystem permissions for compatibility. Show the target paths and permission mode, explain the risk, and prefer a narrower mode when shared write access is not needed.
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
| Command |
Description |
test |
Check if pattern matches. Shows first match position and groups. |
findall |
Find all matches with positions and captured groups. --json for JSON output. |
replace |
Regex search-and-replace. Supports \1 backreferences. --count N limits replacements. |
explain |
Break down a regex into plain-English explanation of each element. |
validate |
Check if a regex pattern is syntactically valid. |
patterns |
List 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
| Flag |
Description |
-i, --ignorecase |
Case-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---2name: regex-toolkit3description: Test, match, extract, replace, explain, and validate regular expressions from the command line. Includes a library of 25+ common patterns (email, URL, IP, phone, date, UUID, etc.) that can be used by name. Use when the user needs to build, debug, or test regex patterns, extract data with regex, do search-and-replace with backreferences, or understand what a regex does. Zero external dependencies.4---5
6
7
8
9### Permission Setup Review
10
11`python scripts/_setup_logs.py` is an optional setup helper for the `Regex Toolkit` skill. It may apply broad filesystem permissions for compatibility. Show the target paths and permission mode, explain the risk, and prefer a narrower mode when shared write access is not needed.
12
13# Regex Toolkit
14
15Test, find, replace, explain, and validate regular expressions. Includes 25+ common named patterns. Pure Python, no dependencies.
16
17## Quick Start
18
19```bash
20# Test a pattern
21python3 scripts/regex_toolkit.py test '\d+' --text 'abc 123 def'
22
23# Use a named pattern (email, url, ipv4, phone-us, uuid, etc.)
24python3 scripts/regex_toolkit.py findall email --text 'Contact hello@example.com or support@test.org'
25
26# Find all matches with positions
27python3 scripts/regex_toolkit.py findall '\b\w{5}\b' --file input.txt
28
29# Search and replace
30python3 scripts/regex_toolkit.py replace '\bfoo\b' -r bar --text 'foo bar foo'
31
32# Explain a regex in plain English
33python3 scripts/regex_toolkit.py explain '(?P<year>\d{4})-(\d{2})-(\d{2})'
34
35# Validate regex syntax
36python3 scripts/regex_toolkit.py validate '[a-z'
37
38# List all common patterns
39python3 scripts/regex_toolkit.py patterns --list
40
41# Pipe from stdin
42echo "Call 555-1234 or 555-5678" | python3 scripts/regex_toolkit.py findall phone-us
43```
44
45## Commands
46
47| Command | Description |
48|---------|-------------|
49| `test` | Check if pattern matches. Shows first match position and groups. |
50| `findall` | Find all matches with positions and captured groups. `--json` for JSON output. |
51| `replace` | Regex search-and-replace. Supports `\1` backreferences. `--count N` limits replacements. |
52| `explain` | Break down a regex into plain-English explanation of each element. |
53| `validate` | Check if a regex pattern is syntactically valid. |
54| `patterns` | List built-in common patterns or show a specific one by name. |
55
56## Input Options
57
58All matching commands accept: `--text 'string'`, `--file path`, or piped stdin.
59
60## Flags
61
62| Flag | Description |
63|------|-------------|
64| `-i, --ignorecase` | Case-insensitive matching |
65| `-m, --multiline` | `^`/`$` match line boundaries |
66| `-s, --dotall` | `.` matches newline |
67
68## Built-in Patterns
69
70Use 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`.