andre-dietrich/elm-random-regex/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Random.Regex

This library helps you generate random strings from regular expressions.

It is not tested yet, but in most cases it works. What is missing so far, is

ascii : String -> Result String (Generator String)

Create a generator that produces ASCII strings based on a regular expression. Infinty is set to max 100, if you are using modifiers such as * or +. It is a shortcut for function generate.

generate : Encoding -> Int -> String -> Result String (Generator String)

Create a generator that produces strings based on regular expressions.

generate ASCII 200 "a-z*" of
    Ok result ->
        ( model, Random.generate GenResult result )


    Err msg ->
        ( { model | result = msg }, Cmd.none )
unicode : String -> Result String (Generator String)

Create a generator that produces UNICODE strings based on a regular expression. Infinty is set to max 100, if you are using modifiers such as * or +. It is a shortcut for function generate.

= ASCII
| UNICODE

Encoding defines the type of random characters to generate, for example for the . dot operator.

- `ASCII` : will generate values between 0 and 255
- `UNICODE` : will generate 16 bit values