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) ReplaceFileFunc(name string, rep func(data func(int) []byte) []byte, all bool, ...) error
- func (reg *Regexp) ReplaceFileString(name string, rep []byte, all bool, maxReSize ...int64) error
- func (reg *Regexp) ReplaceFunc(str []byte, rep func(data func(int) []byte) []byte, blank ...bool) []byte
- func (reg *Regexp) ReplaceString(str []byte, rep []byte) []byte
- func (reg *Regexp) ReplaceStringLiteral(str []byte, rep []byte) []byte
- func (reg *Regexp) Split(str []byte) [][]byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Regexp ¶
type Regexp struct { RE pcre.Regexp // contains filtered or unexported fields }
func CompileTry ¶
CompTry tries to compile or returns an error
func (*Regexp) ReplaceFileFunc ¶ added in v8.1.2
func (reg *Regexp) ReplaceFileFunc(name string, rep func(data func(int) []byte) []byte, all bool, maxReSize ...int64) error
ReplaceFileFunc replaces a regex match with the result of a callback function in a file
@all: if true, will replace all text matching @re, if false, will only replace the first occurrence
func (*Regexp) ReplaceFileString ¶ added in v8.1.2
ReplaceFileString replaces a regex match with a new []byte in a file
@all: if true, will replace all text matching @re, if false, will only replace the first occurrence
func (*Regexp) ReplaceFunc ¶
func (reg *Regexp) ReplaceFunc(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) ReplaceString ¶
ReplaceString 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
func (*Regexp) ReplaceStringLiteral ¶
ReplaceStringLiteral replaces a string with another string
@rep uses the literal string, and does Not use args like $1