joetjen.net
EN DE
← All libraries
Elixir

xeger

Generates strings that match a regex-like pattern. Think: regex → strings.

Intention

Useful for test data, fixtures and property-based generation, where you already have the pattern and want examples of it. It covers the generatable subset of regex syntax — no backreferences, no lookarounds — and streams lazily, so unbounded quantifiers stay infinite instead of being silently capped.

Example
Xeger.take("a(b|c){2}\\d", 10)
#=> ["abb0", "abb1", ...]
Install
{:xeger, "~> 0.1.0"}
ElixirRegexGeneration