regexp

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEngine

func SetEngine(engine Engine)

SetEngine selects the regex engine used by subsequent MustCompile calls.

func Version

func Version() string

Version returns the name of the active regex engine.

Types

type Engine

type Engine interface {
	Compile(str string) (internal.CompiledRegexp, error)
	Version() string
}

type Regexp

type Regexp struct {
	// contains filtered or unexported fields
}

Regexp wraps a regular expression. Compilation is deferred until first match.

func Compile

func Compile(str string) (*Regexp, error)

Compile parses a regular expression using the currently selected engine. If successful, returns a Regexp object that can be used to match against text.

func MustCompile

func MustCompile(str string) *Regexp

MustCompile compiles a regular expression using the currently selected engine.

func (*Regexp) Compile

func (r *Regexp) Compile() error

func (*Regexp) FindAllStringIndex

func (r *Regexp) FindAllStringIndex(s string, n int) [][]int

func (*Regexp) FindString

func (r *Regexp) FindString(s string) string

func (*Regexp) FindStringSubmatch

func (r *Regexp) FindStringSubmatch(s string) []string

func (*Regexp) MatchString

func (r *Regexp) MatchString(s string) bool

func (*Regexp) NumSubexp

func (r *Regexp) NumSubexp() int

func (*Regexp) ReplaceAllString

func (r *Regexp) ReplaceAllString(src, repl string) string

func (*Regexp) String

func (r *Regexp) String() string

func (*Regexp) SubexpNames

func (r *Regexp) SubexpNames() []string

type Stdlib

type Stdlib struct{}

Stdlib is an Engine that uses the standard regexp package.

func (Stdlib) Compile

func (Stdlib) Compile(str string) (internal.CompiledRegexp, error)

func (Stdlib) Version

func (Stdlib) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL