Documentation ¶
Overview ¶
Package regex wraps the Golang regexp package to provide more convenient access to some features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Patterns are a combination of static string components and regex validation. Any piece of the string contained in brackets {} will be matched as regex, while any outside of brackets will be matched as itself; for example, {.*}.jnichols.{.*} matches any subdomain and top-level domain for jnichols. Patterns *must* contain some regex. It performs generally equivalent to the exact same regex in brackets (see regex_bench_test.go) and better if static string parts are swapped out of the expression entirely.
func CompilePattern ¶
CompilePattern compiles a string pattern expression to a *regex.Pattern.
Returns patt, isPatt, err, where err != nil if the pattern is invalid and !isPatt if the provided expression is valid, but not a pattern (a static string).