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.
| Command | Description |
|---|---|
| --------- | ------------- |
regexpal test | Test if a regex matches text — reports full match, partial match, groups, and named groups |
regexpal match | Find all matches in a file — highlights matches in red, shows line numbers and match count |
regexpal replace | Replace all matches in a file and output to stdout. Supports backreferences (\1, \2) |
regexpal extract | Extract capturing groups from all matches in a file — shows each group value per match |
regexpal explain | Break down a regex pattern — lists character classes, groups, tokens, and quantifiers |
python3 (uses re stdlib module)# 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.-]+'
共 2 个版本