Package pattern implements lightweight parsable string patterns.
Pattern can either match or not match a string.
Exact returns a pattern that matches s only.
MustParse parses the pattern according to the specification of Parse. In addition, it panics if there is an error in parsing the given string as a pattern.
See Parse for more details.
Parse parses a pattern.
Ordered by precedence, s can be:
- "": matches nothing - "*": matches anything - "<S>" where S does not have a colon: same as "exact:<S>" - "exact:<S>": matches only string S - "text:<S>": same as "exact:<S>" for backward compatibility - "regex:<E>": matches all strings matching regular expression E. If E does not start/end with ^/$, they are added automatically.
Anything else will cause an error.
Regexp returns a regular expression-based pattern.