Documentation ¶
Index ¶
- func Escape(re string) string
- func IsValid(str []byte) bool
- func JoinBytes(bytes ...interface{}) []byte
- type PCRE
- type RE2
- type Regexp
- func (reg *Regexp) Match(str []byte) bool
- func (reg *Regexp) RepFunc(str []byte, rep func(data func(int) []byte) []byte, blank ...bool) []byte
- func (reg *Regexp) RepStr(str []byte, rep []byte) []byte
- func (reg *Regexp) RepStrComp(str []byte, rep []byte) []byte
- func (reg *Regexp) Split(str []byte) [][]byte
- type RegexpRE2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Regexp ¶
type Regexp struct {
RE *pcre.Regexp
}
func (*Regexp) RepFunc ¶
func (reg *Regexp) RepFunc(str []byte, rep func(data func(int) []byte) []byte, blank ...bool) []byte
RepFunc replaces a string with the result of a function similar to JavaScript .replace(/re/, function(data){})
func (*Regexp) RepStr ¶
RepStr replaces a string with another string note: this function is optimized for performance, and the replacement string does not accept replacements like $1
func (*Regexp) RepStrComp ¶
RepStrComp is a more complex version of the RepStr method this function will replace things in the result like $1 with your capture groups use $0 to use the full regex capture group use ${123} to use numbers with more than one digit
type RegexpRE2 ¶
func (*RegexpRE2) RepFunc ¶
func (reg *RegexpRE2) RepFunc(str []byte, rep func(data func(int) []byte) []byte, blank ...bool) []byte
RepFunc replaces a string with the result of a function similar to JavaScript .replace(/re/, function(data){})
func (*RegexpRE2) RepStrComp ¶
RepStrComp is a more complex version of the RepStr method this function will replace things in the result like $1 with your capture groups use $0 to use the full regex capture group use ${123} to use numbers with more than one digit