Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct { Pattern *Pattern // contains filtered or unexported fields }
Match represents a (sub)match as defined by the go regexp package. It stores a pointer to the underlying regex pattern as well as the capture groups' contents
func (*Match) Capture ¶
Capture returns an individual capture group of the given Match m in the order of their declaration in the pattern of m.Pattern. Beware that m.Capture(0) returns the entire match, so m.Capture(1) will return the first capture group of the match and so forth
func (*Match) CaptureByName ¶
CaptureByName will return the capture group of the given Match m with the identifier name as specified in the pattern m.Pattern. This method will panic if name is not a valid name of any capture group of m.Pattern
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern represents a regex-pattern similar to regexp.Regexp and essentially works in the same way.
func MustCompile ¶
MustCompile returns a new Pattern p with an underlying *regexp.Regexp that is created as specified by regexp.MustCompile(..). This method allows for appending the names of the capture groups after pattern. To refer to a capture group name in the pattern use %s as specified by e.g. fmt.Sprintf(..)
func (*Pattern) FindStringSubmatch ¶
FindStringSubmatch works like *regexp.Regexp.FindStringSubmatch(...) but returns an error if s can't be matched against the pattern p