# 使用 Homebrew, MacPorts, Nix, pacman, zypper, scoop 安装 grex

查看 grex 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

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

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install grex
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install grex
```

  证据: 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
```

  证据: 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
```

  证据: 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
```

  证据: openSUSE Tumbleweed package metadata: grex from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

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

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

## 软件包事实

- **软件包键:** brew:grex
- **软件包管理器:** Homebrew
- **版本:** 1.4.6
- **来源摘要:** Command-line tool for generating regular expressions
- **主页:** <https://pemistahl.github.io/grex-js/>
- **仓库:** <https://github.com/pemistahl/grex>
- **最后更新:** 2026-06-15T10:20:17-04:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- grex (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.4.6
## 项目历史与用法

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.

### 项目历史

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.

### 采用历史

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.

### 使用方式

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.

### 为什么软件包爱好者会关心

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.

### 时间线

- 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.

### 来源

- <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>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- 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.4: normalized package name match | openSUSE Tumbleweed package metadata: grex from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-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


## Combined YAML source

View the package source record on GitHub. [combined/grex.yml](https://github.com/mxcl/pkgdb/blob/main/combined/grex.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
