Documentation
¶
Overview ¶
Package regexp wraps the go regexp package with a few additional features: - Support for re2 syntax - Backtracking + compatibility with Perl5 and .NET syntax via github.com/dlclark/regexp2
Index ¶
- type EngineType
- type Option
- type Regexp
- func (r *Regexp) Find(b []byte) []byte
- func (r *Regexp) FindString(s string) string
- func (r *Regexp) FindStringSubmatch(s string) []string
- func (r *Regexp) FindStringSubmatchIndex(s string) []int
- func (r *Regexp) Match(b []byte) bool
- func (r *Regexp) MatchString(s string) bool
- func (r *Regexp) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EngineType ¶
type EngineType string
EngineType represents the type of regexp engine to use
const ( // EngineStandard uses the standard Go regexp engine EngineStandard EngineType = "standard" // EngineRegexp2 uses the regexp2 engine for .NET-style regex EngineRegexp2 EngineType = "regexp2" // EngineRE2 uses the RE2 engine for linear time matching EngineRE2 EngineType = "re2" // EngineAuto automatically selects the most appropriate engine EngineAuto EngineType = "auto" )
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp represents an extended regular expression with additional options
func (*Regexp) Find ¶
Find returns a slice holding the text of the leftmost match in b of the regular expression.
func (*Regexp) FindString ¶
FindString returns a string holding the text of the leftmost match in s of the regular expression.
func (*Regexp) FindStringSubmatch ¶
FindStringSubmatch returns a slice of strings holding the text of the leftmost match of the regular expression in s and the matches of its subexpressions.
func (*Regexp) FindStringSubmatchIndex ¶
FindStringSubmatchIndex returns a slice holding the index pairs identifying the leftmost match of the regular expression in s and the matches of its subexpressions.
func (*Regexp) Match ¶
Match reports whether the byte slice b contains any match of the regular expression.
func (*Regexp) MatchString ¶
MatchString reports whether the string s contains any match of the regular expression.