randex v0.4.0 Randex
Randex is a regex based random string generator.
Example
iex(1)> Randex.stream(~r/(1[0-2]|0[1-9])(:[0-5]){2} (A|P)M/) |> Enum.take(10)
["10:53:29 AM", "02:54:11 AM", "09:23:04 AM", "10:41:57 AM", "11:42:13 AM",
"10:27:37 AM", "06:15:18 AM", "03:09:58 AM", "09:15:06 AM", "04:25:28 AM"]
Unsupported Features
Summary
Functions
Generates random strings that match the given regex
Functions
Generates random strings that match the given regex
Options
max_repetition: (integer) There is no upper limit for some of the quantifiers like
+
,*
etc. This config specifies how the upper limit should be calculated in these cases. The range is calculated asmin..(min + max_repetition)
. Defaults to100
.mod: (module) The library comes with 3 different types of generators. Defaults to
Randex.Generator.Random
Randex.Generator.Random
- Generates the string in a random manner.
Randex.Generator.DFS
- This does a depth first traversal. This could be used to generate all possible strings in a systematic manner.
Randex.Generator.StreamData
- This is built on top of the StreamData
generators. It could be used as a generator in property testing. Note: this generator might not work well with complicated lookahead or lookbehind expressions.