squeeze [](https://github.com/aymericbeaumet/squeeze/actions/workflows/ci.yml)
August 5, 2026 · View on GitHub
squeeze extracts structured information—such as URLs, emails, IP addresses, paths, and hashes—from text in formats including Markdown, JSON, HTML, and YAML.
Currently supported:
| Finder | Flag | Examples |
|---|---|---|
| CIDR | --cidr | 192.168.1.0/24, 2001:db8::/32 |
| Codetags | --codetag, --todo, --fixme | TODO: fix this, FIXME(#42): bug |
| Colors | --color | #ff0000, rgb(255, 0, 0), hsl(0, 100%, 50%) |
| Datetimes | --datetime | 2024-01-15, 2024-01-15T10:30:00Z |
| Domains | --domain | example.com, mail.example.co.uk |
| Emails | --email | user@example.com, first.last+tag@company.co.uk |
| Emojis | --emoji | 😀, 👨👩👧👦, 1️⃣ |
| Env vars | --env | $HOME, ${PATH}, ${VAR:-default} |
| Handles | --handle | @alice, @user@example.social |
| Hashes | --hash, --md5, --sha256 | 5d41402abc4b2a76b9719d911017c592 |
| IPs | --ip, --ipv4, --ipv6 | 192.168.1.1, ::1, 2001:db8::1 |
| JSON | --json | {"key": "value"}, [1, 2, 3] |
| JWTs | --jwt | eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOi... |
| MACs | --mac | 00:1A:2B:3C:4D:5E, 001A.2B3C.4D5E |
| Modelines | --modeline | vim: set ts=4 sw=4 et: |
| Paths | --path | /etc/hosts, ./src/main.rs:42:10 |
| Phones | --phone | +14155551234, (415) 555-1234 |
| Semver | --semver | 1.0.0, v2.3.1-rc.1+build.42 |
| URIs | --uri, --url, --http, --https | https://example.com, ftp://host/file |
| UUIDs | --uuid | 550e8400-e29b-41d4-a716-446655440000 |
See integrations for some practical uses. Continue reading for the install and getting started instructions.
Install
Using Homebrew (macOS/Linux)
brew tap aymericbeaumet/tap
brew install squeeze
Using Cargo
This method requires the Rust toolchain to be installed on your machine.
cargo install --git https://github.com/aymericbeaumet/squeeze squeeze-cli
From source
git clone --depth=1 https://github.com/aymericbeaumet/squeeze.git /tmp/squeeze
cargo install --path=/tmp/squeeze/squeeze-cli
Getting Started
Let's start by extracting a URL, squeeze expects the text to be searched on
its standard input, with the results being placed on its standard output:
echo 'lorem https://github.com ipsum' | squeeze -1 --url
https://github.com
The
-1flag allows to immediately abort after one result has been found.
If you want to print all the URLs, just omit the -1 flag:
squeeze --url << EOF
this a domain: github.com, but this is a url: https://aymericbeaumet.com
this is some markdown: [link](https://wikipedia.com)
EOF
https://aymericbeaumet.com
https://wikipedia.com
Extract other types of information the same way:
echo '2024-01-15T10:30:00Z server at 192.168.1.0/24' | squeeze --datetime --cidr
2024-01-15T10:30:00Z
192.168.1.0/24
Enable several finders at the same time:
squeeze --url --email --todo << EOF
// TODO: email alice@example.com about https://example.com
http://localhost
EOF
TODO: email alice@example.com about https://example.com
alice@example.com
https://example.com
http://localhost
Some finders support sub-filters. For example --codetag=todo or its alias
--todo, --uri=https, --hash=sha256, etc.
Output flags
Combine finders with these flags to massage the output:
| Flag | Description |
|---|---|
-1, --first | only show the first match |
--last | only show the last match |
--sort | sort the results |
--uniq | deduplicate the results |
--copy | copy the results to the system clipboard |
--output <fmt> | output as text (default), json, yaml, csv, or none |
-j, --jobs <N> | scan lines in parallel using N worker threads (-1/--first always scans sequentially) |
--all | enable all regular finders |
--with-kind | include the finder id, and structured metadata for non-text formats |
--no-overlap | suppress overlapping matches |
--precedence <first|longest> | choose the overlap policy used with --no-overlap |
See all the possibilities with squeeze --help.
With no INPUT arguments, squeeze scans standard input. To scan files
instead, pass file paths or quoted glob patterns after the options:
squeeze --all --with-kind --output json 'logs/*.txt'
Integrations
Integrations with some popular tools.
vim/nvim
Press Enter in visual mode to extract the first URL from the current
selection and open it:
" ~/.vimrc
vnoremap <silent> <CR> :<C-U>'<,'>w !squeeze -1 --url --open<CR><CR>
tmux
Press Enter in copy mode to extract the first URL from the current selection
and open it:
# ~/.tmux.conf
bind -T copy-mode-vi enter send -X copy-pipe-and-cancel "squeeze -1 --url --open"
shell (bash, zsh)
For example, define a function that extracts URLs from your shell history:
# ~/.bashrc ~/.zshrc
urls() { fc -rl 1 | squeeze --url | sort -u; }
Development
Run binary
echo 'http://localhost' | cargo run -- --url
Run tests
cargo test
watchexec --clear --restart 'cargo test'