Documentation
¶
Overview ¶
Package regexamples generates random strings that match a given regular expression.
Index ¶
Constants ¶
View Source
const (
// DefaultMaxRepeat is the default cap for unbounded quantifiers (*, +, and {n,} without upper bound).
DefaultMaxRepeat = 10
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator holds a compiled pattern and a random source, and can produce multiple matching strings efficiently.
A Generator is not safe for concurrent use. If you need to generate strings from multiple goroutines, create a separate Generator per goroutine or protect access with a sync.Mutex.
func NewGenerator ¶
NewGenerator compiles pattern and returns a Generator ready to produce matching strings. Returns an error if the pattern is invalid.
Click to show internal directories.
Click to hide internal directories.