Documentation ¶
Overview ¶
Package gregex provides high performance API for regular expression functionality.
Index ¶
- func IsMatch(pattern string, src []byte) bool
- func IsMatchString(pattern string, src string) bool
- func Match(pattern string, src []byte) ([][]byte, error)
- func MatchAll(pattern string, src []byte) ([][][]byte, error)
- func MatchAllString(pattern string, src string) ([][]string, error)
- func MatchString(pattern string, src string) ([]string, error)
- func Quote(s string) string
- func Replace(pattern string, replace, src []byte) ([]byte, error)
- func ReplaceFunc(pattern string, src []byte, replaceFunc func(b []byte) []byte) ([]byte, error)
- func ReplaceFuncMatch(pattern string, src []byte, replaceFunc func(match [][]byte) []byte) ([]byte, error)
- func ReplaceString(pattern, replace, src string) (string, error)
- func ReplaceStringFunc(pattern string, src string, replaceFunc func(s string) string) (string, error)
- func ReplaceStringFuncMatch(pattern string, src string, replaceFunc func(match []string) string) (string, error)
- func Split(pattern string, src string) []string
- func Validate(pattern string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMatchString ¶
IsMatchString checks whether given string `src` matches `pattern`.
func MatchAllString ¶
MatchAllString return all strings that matched `pattern`.
func MatchString ¶
MatchString return strings that matched `pattern`.
func Quote ¶
Quote quotes `s` by replacing special chars in `s` to match the rules of regular expression pattern. And returns the copy.
Eg: Quote(`[foo]`) returns `\[foo\]`.
func ReplaceFunc ¶
ReplaceFunc replace all matched `pattern` in bytes `src` with custom replacement function `replaceFunc`.
func ReplaceFuncMatch ¶
func ReplaceFuncMatch(pattern string, src []byte, replaceFunc func(match [][]byte) []byte) ([]byte, error)
ReplaceFuncMatch replace all matched `pattern` in bytes `src` with custom replacement function `replaceFunc`. The parameter `match` type for `replaceFunc` is [][]byte, which is the result contains all sub-patterns of `pattern` using Match function.
func ReplaceString ¶
ReplaceString replace all matched `pattern` in string `src` with string `replace`.
func ReplaceStringFunc ¶
func ReplaceStringFunc(pattern string, src string, replaceFunc func(s string) string) (string, error)
ReplaceStringFunc replace all matched `pattern` in string `src` with custom replacement function `replaceFunc`.
func ReplaceStringFuncMatch ¶
func ReplaceStringFuncMatch(pattern string, src string, replaceFunc func(match []string) string) (string, error)
ReplaceStringFuncMatch replace all matched `pattern` in string `src` with custom replacement function `replaceFunc`. The parameter `match` type for `replaceFunc` is []string, which is the result contains all sub-patterns of `pattern` using MatchString function.
Types ¶
This section is empty.