Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randstr

randstr is a regex-based random string generator, written in Rust.

Supports the full Rust regex syntax and PCRE2 Unicode character property classes (e.g., \p{Ahex}, \P{Ps}).

Usage

randstr REGEX

Given some regex pattern as input, the program will output a random string which satisfies that regex:

$ for _ in {1..4}; do randstr '((heads|tails)\t){4}'; done
tails	tails	tails	heads	
tails	heads	heads	tails	
heads	tails	heads	heads	
heads	heads	heads	heads	

$ randstr 'blob(-[\p{AHex}&&[^[:lower:]]]{8,16}){3}'
blob-EF11B56C40457E-9B720BD8CCBB-C4C3FE24A7AFC906

$ randstr 'valid email: [a-zA-Z0-9._%+-]{1,32}@[a-zA-Z0-9.-]{1,32}\.[a-zA-Z]{2,32}'
valid email: ZllZU-HbtUYbpu@Y45HUuGTKzq2gx.mWvsfmNxRhwjyzPEgZxB

$ randstr '[\p{Tibetan}&&\p{L}]{20}'
ཆཌྷༀདཫཋབྷཅཤཅམཐཬཙཎཇྌཨཛཡ

Installation

Install and compile the binary using cargo:

cargo install --git https://github.com/crypt0lith/randstr

Or download a precompiled binary of the latest release.

About

Generate random strings from regular expressions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages