grexis a library as well as a command-line utility that is meant to simplify the often complicated and tedious task of creating regular expressions. It does so by automatically generating a single regular expression from user-provided test cases. The resulting expression is guaranteed to match the test cases which it was generated from.
As Stefan shows: simply type in some terms into
grex that you want to match and the RegExp comes out … 🤯
I just learned about the CLI tool `grex`. It might change how I approach regular expressions (🤞🙈).
You provide string values and it comes up with a regular expression matching them.😲https://t.co/69y4NGcwjQ
Video alt: CLI session showing multiple generated reg. expressions. pic.twitter.com/20A9W4C6Zr
— Stefan Judis (@stefanjudis) March 21, 2021
Also available as a Rust library.
use grex::RegExpBuilder; let regexp = RegExpBuilder::from(&["a", "aa", "aaa"]).build(); assert_eq!(regexp, "^a(?:aa?)?$");