Documentation
¶
Overview ¶
Package pattern holds the regular expressions that gohai keeps in package variables. regexp.MustCompile panics on a bad expression, and code in gohai does not panic. New compiles without a panic: a bad expression gives a Pattern that matches nothing, and Errors reports it. A test that links every collector checks that Errors is empty, so a bad expression fails the build of the tests, not a host.
Index ¶
- func Errors() error
- type Pattern
- func (p *Pattern) FindAllString(s string, n int) []string
- func (p *Pattern) FindAllStringSubmatch(s string, n int) [][]string
- func (p *Pattern) FindStringSubmatch(s string) []string
- func (p *Pattern) FindSubmatch(b []byte) [][]byte
- func (p *Pattern) MatchString(s string) bool
- func (p *Pattern) ReplaceAllString(s string, repl string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is a compiled regular expression. A Pattern whose expression did not compile matches nothing.
func New ¶
New compiles expr. When expr does not compile, New records the error for Errors and returns a Pattern that matches nothing.
func (*Pattern) FindAllString ¶
FindAllString returns up to n successive matches in s, or all of them when n is negative, or nil when there is no match.
func (*Pattern) FindAllStringSubmatch ¶
FindAllStringSubmatch returns up to n successive matches in s and their submatches, or all of them when n is negative, or nil when there is no match.
func (*Pattern) FindStringSubmatch ¶
FindStringSubmatch returns the leftmost match in s and its submatches, or nil when there is no match.
func (*Pattern) FindSubmatch ¶
FindSubmatch returns the leftmost match in b and its submatches, or nil when there is no match.
func (*Pattern) MatchString ¶
MatchString reports whether s contains a match of the pattern.