# Install grex with Homebrew, MacPorts, Nix, pacman, scoop, zypper

Command-line tool for generating regular expressions. Version 1.4.6 via Homebrew; verified 2026-06-15.

## Install

```sh
sudo av install brew:grex
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install grex
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install grex
```

  Evidence: MacPorts ports tree: textproc/grex/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#grex
```

  Evidence: nixpkgs package indexes: pkgs/by-name/gr/grex/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S grex
```

  Evidence: Arch Linux sync databases: grex from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install grex
```

  Evidence: openSUSE Tumbleweed package metadata: grex from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/grex
```

  Evidence: Scoop official bucket manifest trees: bucket/grex.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## Package facts

- **Package key:** brew:grex
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/grex>
- **Version:** 1.4.6
- **Source summary:** Command-line tool for generating regular expressions
- **Homepage:** <https://pemistahl.github.io/grex-js/>
- **Repository:** <https://github.com/pemistahl/grex>
- **Upstream docs:** <https://github.com/pemistahl/grex#readme>
- **License:** Apache-2.0
- **Source archive:** <https://github.com/pemistahl/grex/archive/refs/tags/v1.4.6.tar.gz>
- **Last updated:** 2026-06-15T10:20:17-04:00
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- grex (cli)
- grex (alias)

## Build dependencies

- rust

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 1.4.6
- Package-manager updated: 2026-06-15
- Local data: ok
- Upstream repository: https://github.com/pemistahl/grex
- Upstream latest detected: v1.4.6 (current)
## Project history and usage

grex is a Rust command-line tool and library that generates regular expressions from user-provided test cases. It belongs to the developer-tooling tradition around regex synthesis: not replacing regex knowledge, but giving users a correct starting expression that can be inspected and refined.

### Project history

The README states that grex began as a Rust port of Devon Govett's JavaScript regexgen project after regexgen development had apparently ceased. Peter M. Stahl's project kept the regex-generation idea but used Rust's strengths for command-line tooling and expanded the feature set beyond the original port.

Official GitHub releases show public versioned releases starting with v0.1.0 on 2019-10-06, followed by v1.0.0 on 2020-02-02. Later releases added and refined library, CLI, Unicode, packaging, and binding surfaces, while the README presents grex as both a command-line executable and a Rust crate with Python bindings.

### Adoption history

grex reached package-manager users through the Rust ecosystem first, with crates.io as the upstream registry path, and through binary/package managers such as Homebrew, MacPorts, Scoop, Chocolatey, Huber, Nix, Arch, and openSUSE as reflected by the README and batch package facts. Its packaging surface is broad because it is a single CLI binary but also a reusable library.

### How it is used

Users pass examples directly on the command line, from a file, or through a Unix pipeline. By default grex generates a specific expression that matches the supplied test cases; flags can generalize output by converting digits, whitespace, word characters, repeated substrings, anchors, groups, escaping, case sensitivity, verbosity, and colorized display.

The README cautions that generated expressions still need human understanding. That caveat is part of the tool's identity: grex is best used to bootstrap or audit a regex, not to remove the need to understand the target language and engine.

### Why package nerds care

grex is package-nerd significant because it packages an algorithmic helper for one of the most common developer annoyances: turning examples into a regular expression. It is also a Rust CLI case study, distributed as source through cargo and as prebuilt binaries or package-manager formulas for users who do not want a Rust toolchain.

Its relationship to regexgen also makes it a small example of ecosystem migration: a JavaScript idea revived as a Rust CLI and library, then exposed through additional language bindings.

### Timeline

- 2019: v0.1.0 published in the official GitHub release feed.
- 2020: v1.0.0 published after several 0.x releases.
- 2021: v1.2.0 and v1.3.0 releases continued the 1.x line.
- 2022: v1.4.0 and v1.4.1 releases appeared.
- 2024: v1.4.5 published in the official GitHub release feed.
- 2025: v1.4.6 published with release assets for several operating-system and CPU targets.

### Related projects

- regexgen is the JavaScript project that grex began by porting.
- Rust's regex crate is a stated compatibility target for generated expressions.
- grex-js is the related JavaScript/WebAssembly demo and library surface linked from the repository.
- crates.io, PyPI, Homebrew, MacPorts, Scoop, Chocolatey, and Huber are distribution surfaces named by upstream or batch package facts.

### Sources

- <https://api.github.com/repos/pemistahl/grex/releases?per_page=100>
- <https://crates.io/crates/grex>
- <https://github.com/pemistahl/grex>
- <https://raw.githubusercontent.com/pemistahl/grex/main/README.md>


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** grex
- **Version Scheme:** 0
- **Revision:** 0
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

## Other Package-Manager Records

- Nix - grex: normalized package name match | nixpkgs package indexes: pkgs/by-name/gr/grex/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- pacman - grex - 1.4.6-2: normalized package name match | Arch Linux sync databases: grex from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A command-line tool for generating regular expressions from user-provided input strings | https://github.com/pemistahl/grex
- zypper - grex - 1.4.6-1.2: normalized package name match | openSUSE Tumbleweed package metadata: grex from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | CLI regex generator | https://github.com/pemistahl/grex
- MacPorts - grex: normalized package name match | MacPorts ports tree: textproc/grex/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/grex: normalized package name match | Scoop official bucket manifest trees: bucket/grex.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [melody](https://www.automicvault.com/pkg/brew/melody/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions, rust.
- [pomsky](https://www.automicvault.com/pkg/brew/pomsky/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [rgxg](https://www.automicvault.com/pkg/brew/rgxg/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [grok](https://www.automicvault.com/pkg/brew/grok/) - Shares av.db curated category or tags: cli, developer-tools, regular-expressions.
- [onigmo](https://www.automicvault.com/pkg/brew/onigmo/) - Shares av.db curated category or tags: cli, developer-tools, regular-expressions.
- [oniguruma](https://www.automicvault.com/pkg/brew/oniguruma/) - Shares av.db curated category or tags: cli, developer-tools, regular-expressions.
- [tre](https://www.automicvault.com/pkg/brew/tre/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [cargo-generate](https://www.automicvault.com/pkg/brew/cargo-generate/) - Shares av.db curated category or tags: cli, code-generation, developer-tools, rust.

## Combined YAML source

View the package source record on GitHub. [combined/grex.yml](https://github.com/automic-vault/db/blob/main/combined/grex.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
