1 个不稳定版本

0.1.0 2023年12月28日

#1488文本处理

MIT 许可证

9KB
128

regex-cli-test

一个简单的命令行工具,用于编写正则表达式检查。目前只能匹配完整字符串与模式。不匹配的字符串将返回退出代码 1。匹配的字符串将返回 0

安装

只需使用 cargo 从 crates.io 安装。

$ cargo install regex-cli-test

示例:从标准输入进行匹配

$ if echo -n "a" | regex '\w'
> then
> echo "Matches!"
> fi
Matches!

示例:标准输入模式

$ echo -n "\w+" | regex - hello && echo "Matches!"
Matches!

示例:详细输出

详细输出对于调试很有用。

$ echo "a" | regex '\w' -v
Raw pattern: \w
Raw haystack: <none provided>
Taking haystack from standard input.
Pattern: \w
Haystack: a

Line terminator: \n
Case ignored? false
Whitespace ignored? false
Dotall? false
Multiline? false
Octal? false
Greed swapped? false
Unicode? true
Haystack does not match the specified pattern.

依赖项

~4–5.5MB
~97K SLoC