Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern matches a string and extracts key/value pairs.
func Compile ¶
Compile compiles a pattern. Patterns use `%{` and `}` delimiters to define the placing of fields in a string. Two consecutive fields *must* have some delimiter text between them for the pattern to be valid. For example: `%{foo} %{bar}` is valid `%{foo}%{bar}` is not valid Pattern names currently have no restrictions apart from that they cannot contain `}`. Please be conservative with your field names as that might change in the future...
func (*Pattern) FieldName ¶
Returns a non-empty field name by index. Panics if index is out of range. Use in conjunction with NumFields to check the range
func (*Pattern) MatchString ¶
MatchString matches src and appends key/value pairs to dst. Note that if an error occurs the original slice is returned.