wildling

Ruby library and CLI for pattern-based string generation. Zero third-party gems (stdlib only, including json). Requires Ruby 3.0+.

Docs: Website · Sandbox · Syntax · Source

Registry: RubyGems

Example

http://${'dev,stage,prod'}\-${'api,web'}#{0-2}.example.${'com,net,org'}/@.html

(The \- is a literal hyphen; bare - would mean “one letter or digit”. @ is one lowercase letter.)

That builds URL-shaped candidates: scheme http://, then environment × service × optional digits × TLD, then a one-letter path page. Three environments, two services, zero–two digits ('', 09, 0099), three TLDs, and az51948 strings — the kind of list you generate for fuzzing links or probing staging hosts, not type out.

A few of them:

  • http://dev-api.example.com/a.html / http://stage-web.example.com/z.html
  • http://dev-api0.example.net/a.html / http://prod-web9.example.org/m.html
  • http://dev-api00.example.com/a.html / http://prod-web99.example.org/z.html

Named dictionaries (%{'hosts'}) work the same way when the word lists live in files.

Try it in the sandbox, or see pattern syntax for length ranges, dictionaries, and escapes.

Install

From this repository:

cd ruby
./build.sh
./bin/wildling "Year 19##"

Git (Bundler):

gem "wildling", git: "https://github.com/dotmonk/wildling.git", tag: "v2.0.7", glob: "ruby/wildling.gemspec"

Registry:

gem install wildling
wildling "Year 19##"
require "wildling"

wildling = Wildling.create(["Year 19##"])
value = wildling.next
while value != false
  puts value
  value = wildling.next
end

The published gem’s executable is a Ruby stub under exe/ (so gem install + wildling works). The monorepo ./bin/wildling is a separate shell launcher with a Docker fallback when ruby is missing. Gems through 2.0.6 shipped a shell script as the Rubygems executable (broken under gem install); use ruby "$(gem contents wildling | grep bin/wildling.rb)" as a workaround, or install a newer gem once published.

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

Help text and --check output follow docs/cli.md / docs/help.txt.

Build

./build.sh   # Docker (ruby:3.3-alpine): copy help.txt + syntax-check

Project tests live in ../tests/ and are run with ../test.sh.