# README
ER - re regexp
š Installation
As Executable
-
If you have
go
in your system, what you need to do just usego get
go get -u github.com/unbyte/er/cmd/er er --help
-
In other case, you need go to download executable in Release Page, and then rename the executable to
er
( orer.exe
on window ).
As Package
If you want to use er
as a go package, please go get -u github.com/unbyte/er
.
šØ Usage
As Executable
> er --help
Usage of ER CLI:
-a, -amount int
amount of strings to be generated. default to 1. (default 1)
-p, -pattern string
pattern string
Syntax: https://golang.org/pkg/regexp/syntax/
Unicode Class: https://en.wikipedia.org/wiki/Unicode_character_property
> er -p "\d{3}-\d{8}|\d{4}-\d{7}" -a 10
454-16390004
0913-1976506
543-75125853
280-27961072
5049-7522609
7833-1752530
822-89737417
7176-8019427
5181-6167904
090-60481568
> er -p "[š-š]+"
šš
ššššššššššššššššššššš
š
ššššššššššššššššššššššššššš
šš
You can get the syntax of regexp here
and get all unicode groups here
As Package
import (
"github.com/unbyte/er"
"regexp/syntax"
)
func main(){
pattern := "^[A-Za-z_]{10,14}$"
generator, err := er.Parse(pattern, syntax.Perl)
if err != nil {
panic(err)
}
s, err := generator.Generate()
if err != nil {
panic(err)
}
fmt.Println(s)
ss, err := generator.GenerateMultiple(10)
if err != nil {
panic(err)
}
fmt.Println(strings.Join(ss, "\n"))
}
š License
MIT LICENSE.
# Packages
No description provided by the author
# Functions
Generate a random string according to *syntax.Regexp ( got by syntax.Parse() ).
Parse a pattern string and return a Generator if success.
return a random visible ascii.
return a random boolean.
return an int in range [min, max].
return a random int in range [0, max).
return an int in range [min, max].
random rune
runeGroup => []rune{lowA, highA, lowB, highB, ...}, and will return a rune between lowA and highA, or lowB and highB.
# Interfaces
Generator generate string(s).