userland.run70Try the demo
Catalog app · RISC-V VM

Run grex in the browser

Generate a regular expression that matches exactly the example strings you give it.

Try it live

Nothing is downloaded until you press Run.

catalog app

Build a regex from three examples

Installs grex 1.4.6 from the signed catalog (every chunk is verified before it is written), then runs the commands below in the VM's shell.

bash
grex --version
grex foo foobar foobaz
loading…
Expected output
$ grex --version
grex 1.4.6
$ grex foo foobar foobaz
^foo(?:ba[rz])?$

What it is

grex takes test cases and produces a single regex that matches all of them and nothing else, optionally generalising digits, whitespace or repetitions (-d, -s, -r). It is a starting point for hand-tuning rather than a finished pattern. In the browser it runs as a regex helper inside docs and editors.

Package facts

version
1.4.6
runs on
RISC-V VM (elf-app, riscv64gc-linux-musl)
download
1.1 MB compressed · 1 file
command
grex
requires
nothing else — a static binary
license
Apache-2.0 (upstream)
upstream
github.com/pemistahl/grex
categories
Text
catalog
generation 12, Ed25519-signed

Install and run it from your page

With the SDK, installApp resolves grex in the signed index, fetches its content-addressed chunks from the CDN, verifies each one and writes the files into the VM. Details in Installing catalog apps.

javascript
import { createNano } from "@userland-run/nano-sdk";

const nano = await createNano({ image: { wasm: "/nano/console.wasm" }, ramMB: 512 });
await nano.installApp("grex"); // signature-verified, cached in OPFS

const r = await nano.shExec("grex --version");
console.log(r.stdout);

Typical usage of the upstream command-line tool:

bash
grex -r --digits 2024-01-15 2025-12-31

← All 32 catalog apps