grex is 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. This project has started as a Rust port of the JavaScript tool regexgen written by Devon Govett. Although a lot of further useful features could be added to it, its development was apparently ceased several years ago. The plan is now to add these new features to grex as Rust really shines when it comes to command-line tools. grex offers all features that regexgen provides, and more. The philosophy of this project is to generate the most specific regular expression possible by default that exactly matches the given input only and nothing else. With the use of command-line flags (in the CLI tool) or preprocessing methods (in the library).

Features

  • Detection of common prefixes and suffixes
  • Detection of repeated substrings and conversion to {min,max} quantifier notation
  • Alternation using | operator
  • Fully compliant to newest Unicode Standard 13.0
  • Capturing or non-capturing groups
  • Reads input strings from the command-line or from a file

Project Samples

Project Activity

See All Activity >

License

Apache License V2.0

Follow grex

grex Web Site

Other Useful Business Software
Cut Data Warehouse Costs up to 54% with BigQuery Icon
Cut Data Warehouse Costs up to 54% with BigQuery

Migrate from Snowflake, Databricks, or Redshift with free migration tools. Exabyte scale without the Exabyte price.

BigQuery delivers up to 54% lower TCO than cloud alternatives. Migrate from legacy or competing warehouses using free BigQuery Migration Service with automated SQL translation. Get serverless scale with no infrastructure to manage, compressed storage, and flexible pricing—pay per query or commit for deeper discounts. New customers get $300 in free credit.
Try BigQuery Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of grex!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Rust

Related Categories

Rust Terminals, Rust Command Line Tools

Registered

2022-05-13