regen

Tool to generate random strings from Go/RE2 regular expressions

Github星跟踪图

regen

$ go get go.spiff.io/regen

regen is a small tool to generate more or less random strings from Go RE2 regular expressions. You
can read up on RE2 at https://github.com/google/re2/wiki/Syntax.

As a few examples:

$ regen -n 2 '0x[\da-f]{16}'
0x8f5858102a5ce124
0x3e4c9fee6c9f419d

$ regen -n 3 '[a-z]{6,12}(\+[a-z]{6,12})?@[a-z]{6,16}(\.[a-z]{2,3}){1,2}'
iprbph+gqastu@regegzqa.msp
abxfcomj@uyzxrgj.kld.pp
vzqdrmiz@ewdhsdzshvvxjk.pi

Essentially, all regen does is parse the regular expressions it's given and iterate over the tree
produced by regexp/syntax and attempt to generate strings
based on the ops described by its results. This could probably be optimized further by compiling the
resulting Regexp into a Prog, but I didn't feel like this was worthwhile when it's a very small
tool.

Currently, handling word boundaries is not supported and will cause regen to panic in response. The
way line endings and EOT is handled are also likely incorrect and they'll need some more thinking
put into them.

Some additional information can be found at https://godoc.org/go.spiff.io/regen.

Contributing

Currently, development of regen is happening over at https://git.spiff.io. If you'd like to submit
a patch, please first open an issue on GitHub to discuss what you'd like to do and we can go from
there. regen does not currently accept pull requests because changes are replicated from Gerrit to
GitHub, but not vice versa.

License

regen is licensed under a 2-clause BSD license. This can be found in LICENSE.txt.

主要指标

概览
名称与所有者nilium/regen
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证BSD 2-Clause "Simplified" License
所有者活动
创建于2016-03-05 03:01:15
推送于2024-10-27 20:32:40
最后一次提交2018-05-25 14:38:16
发布数3
最新版本名称v0.2.0 (发布于 2024-10-27 13:31:53)
第一版名称v0.1.0 (发布于 )
用户参与
星数79
关注者数1
派生数3
提交数24
已启用问题?
问题数1
打开的问题数1
拉请求数0
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?