Documentation ¶
Overview ¶
TODO: capture index (e.g. %1) TODO: balanced captures TODO: frontier patterns TODO: introduce opSave TODO: eliminate opClose TODO: pattern sets TODO: replace TODO: anchor tail $
Index ¶
- func Match(text, expr string) (captures []string)
- func MatchAll(text, expr string, limit int) (captures [][]string)
- func MatchIndex(text, expr string) (captures []int)
- func MatchIndexAll(text, expr string, limit int) (captures [][]int)
- func Replace(text, expr string, repl Replacer) (string, int)
- func ReplaceAll(text, expr string, repl Replacer, limit int) (string, int)
- type Pattern
- func (patt Pattern) Match(src string) (captures []string)
- func (patt Pattern) MatchAll(src string, limit int) (captures [][]string)
- func (patt Pattern) MatchIndex(src string) (captures []int)
- func (patt Pattern) MatchIndexAll(src string, limit int) (captures [][]int)
- func (patt Pattern) Replace(text string, repl Replacer) (string, int)
- func (patt Pattern) ReplaceAll(text string, repl Replacer, limit int) (string, int)
- type Replacer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Match ¶
Match is like MatchIndex except that the capture are returned instead of the positions.
func MatchAll ¶
MatchAll is like MatchIndexAll excepts that the capture string are returned instead of the positions.
func MatchIndex ¶
MatchIndex matches the first item in text to match the pattern expr. The matche is returned as a slice of integer offsets that points to the boundaries of any captures found in the match.
func MatchIndexAll ¶
MatchIndexAll matches all items in text that match the pattern expr upto limit (or all if limit is -1). The matches are returned as a two-dimensional slice of integer offsets that points to the boundaries of any captures found in the match.
Types ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}