Grex是一个由Rust语言开发的命令行工具和库,根据用户提供的测试用例生成正则表达式。该工具可以作为库或命令行工具使用,提供了丰富的功能和特性,使用户能够快速生成有效的正则表达式。
$ grex a b c
^[a-c]$
$ grex a c d e f
^[ac-f]$
$ grex a b x de
^(?:de|[abx])$
$ grex abc bc
^a?bc$
$ grex a b bc
^(?:bc?|a)$
$ grex [a-z]
^\[a\-z\]$
$ grex -r b ba baa baaa
^b(?:a{1,3})?$
$ grex -r b ba baa baaaa
^b(?:a{1,2}|a{4})?$
$ grex y̆ a z
^(?:y̆|[az])$
Note:
Grapheme y̆ consists of two Unicode symbols:
U+0079 (Latin Small Letter Y)
U+0306 (Combining Breve)
$ grex "I ♥ cake" "I ♥ cookies"
^I ♥ c(?:ookies|ake)$
Note:
Input containing blank space must be
surrounded by quotation marks.
Grex在实际场景中具有广泛的应用,特别适用于以下情况:
开源地址:https://github.com/pemistahl/grex
创作不易分享,赞,在看,三连支持一波,感谢。↓↓↓