Documentation ¶
Index ¶
- func Find(pattern, s string) (string, error)
- func FindAll(pattern, s string, n int) ([]string, error)
- func FindAllNamedSubmatch(pattern, s string, n int) ([]map[string]string, error)
- func FindAllSubmatch(pattern, s string, n int) ([][]string, error)
- func FindNamedSubmatch(pattern, s string) (map[string]string, error)
- func FindSubmatch(pattern, s string) ([]string, error)
- func Match(pattern string, s string) (matched bool, err error)
- func QuoteMeta(s string) string
- func Valid(pattern string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶ added in v0.0.12
Find returns a string holding the text of the leftmost match in s of the regular expression. It returns bottom if there was no match.
func FindAll ¶ added in v0.0.12
FindAll returns a list of all successive matches of the expression. It matches successive non-overlapping matches of the entire expression. Empty matches abutting a preceding match are ignored. The return value is a list containing the successive matches. The integer argument n indicates the maximum number of matches to return for n >= 0, or all matches otherwise. It returns bottom for no match.
func FindAllNamedSubmatch ¶ added in v0.0.12
FindAllNamedSubmatch is like FindAllSubmatch, but returns a map with the named used in capturing groups. See FindNamedSubmatch for an example on how to use named groups.
func FindAllSubmatch ¶ added in v0.0.12
FindAllSubmatch finds successive matches as returned by FindSubmatch, observing the rules of FindAll. It returns bottom for no match.
func FindNamedSubmatch ¶ added in v0.0.12
FindNamedSubmatch is like FindSubmatch, but returns a map with the names used in capturing groups.
Example:
regexp.MapSubmatch(#"Hello (?P<person>\w*)!"#, "Hello World!") Output: [{person: "World"}]
func FindSubmatch ¶ added in v0.0.12
FindSubmatch returns a list of strings holding the text of the leftmost match of the regular expression in s and the matches, if any, of its subexpressions. Submatches are matches of parenthesized subexpressions (also known as capturing groups) within the regular expression, numbered from left to right in order of opening parenthesis. Submatch 0 is the match of the entire expression, submatch 1 the match of the first parenthesized subexpression, and so on. It returns bottom for no match.
func Match ¶
Match reports whether the string s contains any match of the regular expression pattern. More complicated queries need to use Compile and the full Regexp interface.
Types ¶
This section is empty.