A Golang library for generating random strings from regular expressions.
Checkout https://goregen-demo.herokuapp.com for a live demo.
See the godoc for examples.
randexp for Go.
Home Page: https://godoc.org/github.com/zach-klippenstein/goregen
License: Apache License 2.0
A Golang library for generating random strings from regular expressions.
Checkout https://goregen-demo.herokuapp.com for a live demo.
See the godoc for examples.
generator.Generate()
returns the same string when run multiple times. Is this the expected behaviour?
package main
import (
"math/rand"
"fmt"
regen "github.com/zach-klippenstein/goregen"
)
func main() {
pattern := `^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`
generator, _ := regen.NewGenerator(pattern, ®en.GeneratorArgs{
RngSource: rand.NewSource(0),
})
// for i := 0; i < 10; i++ {
fmt.Printf("email is %s\n", generator.Generate())
// }
}
GoConvey makes tests more readable and descriptive, and has more flexible assertions.
Hey,
First of all, I want to appreciate the author of this project. This library is super useful for testing. Sadly, the repo is abandoned, so I had to fork it to drop unnecessary dependencies.
My fork is here: https://github.com/AnatolyRugalev/goregen. Changelog:
Cheers.
consider regex 0{1,10}
, https://goregen-demo.herokuapp.com/?Regex=0%7B1%2C10%7D&Count=10
after performing this query 10 times it appears that the results are skewed towards the lower lengths, with a majority of the results being 0
and 00
. wondering if you have any insights into this or its just my imagination? perhaps it is related to how the value is generated in the case of this regex?
in contrast, a regex like this https://goregen-demo.herokuapp.com/?Regex=0%7C%5B1-9%5D&Count=10 appears to consistently distribute randomly across the domain.
There is a dependency on (unmaintained) gxui, just to get math.Max
from gxui in tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.