rext

package
v0.0.169 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptRegexMatchGroup added in v0.0.96

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

func (OptRegexMatchGroup) End added in v0.0.96

func (g OptRegexMatchGroup) End() int

func (OptRegexMatchGroup) Exists added in v0.0.96

func (g OptRegexMatchGroup) Exists() bool

func (OptRegexMatchGroup) IsEmpty added in v0.0.96

func (g OptRegexMatchGroup) IsEmpty() bool

func (OptRegexMatchGroup) Length added in v0.0.96

func (g OptRegexMatchGroup) Length() int

func (OptRegexMatchGroup) Range added in v0.0.96

func (g OptRegexMatchGroup) Range() (int, int)

func (OptRegexMatchGroup) Start added in v0.0.96

func (g OptRegexMatchGroup) Start() int

func (OptRegexMatchGroup) Value added in v0.0.96

func (g OptRegexMatchGroup) Value() string

func (OptRegexMatchGroup) ValueOrEmpty added in v0.0.96

func (g OptRegexMatchGroup) ValueOrEmpty() string

func (OptRegexMatchGroup) ValueOrNil added in v0.0.97

func (g OptRegexMatchGroup) ValueOrNil() *string

type Regex

type Regex interface {
	IsMatch(haystack string) bool
	MatchFirst(haystack string) (RegexMatch, bool)
	MatchAll(haystack string) []RegexMatch
	ReplaceAll(haystack string, repl string, literal bool) string
	ReplaceAllFunc(haystack string, repl func(string) string) string
	RemoveAll(haystack string) string
	GroupCount() int
}

func W

func W(rex *regexp.Regexp) Regex

type RegexMatch

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

func (RegexMatch) FullMatch

func (m RegexMatch) FullMatch() RegexMatchGroup

func (RegexMatch) GroupByIndex

func (m RegexMatch) GroupByIndex(idx int) RegexMatchGroup

GroupByIndex returns the value of a matched group (group 0 == whole match)

func (RegexMatch) GroupByName

func (m RegexMatch) GroupByName(name string) RegexMatchGroup

GroupByName returns the value of a matched group (panics if not found!)

func (RegexMatch) GroupByNameOrEmpty added in v0.0.96

func (m RegexMatch) GroupByNameOrEmpty(name string) OptRegexMatchGroup

GroupByName returns the value of a matched group (returns empty OptRegexMatchGroup if not found)

func (RegexMatch) GroupCount

func (m RegexMatch) GroupCount() int

GroupCount returns the amount of groups in this match, does not count group-0 (whole match)

type RegexMatchGroup

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

func (RegexMatchGroup) End

func (g RegexMatchGroup) End() int

func (RegexMatchGroup) Length

func (g RegexMatchGroup) Length() int

func (RegexMatchGroup) Range

func (g RegexMatchGroup) Range() (int, int)

func (RegexMatchGroup) Start

func (g RegexMatchGroup) Start() int

func (RegexMatchGroup) Value

func (g RegexMatchGroup) Value() string

Jump to

Keyboard shortcuts

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