regex

package
v0.15.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegexNameGroup      = "NAME"
	RegexNamespaceGroup = "NAMESPACE"
)

Variables

This section is empty.

Functions

func IndexBasedReplace

func IndexBasedReplace(input string, items []IndexBasedReplaceItem) string

IndexBasedReplace replaces multiple substrings in the input string with the replacement values based on the indexes in the original input string. input - string that will have parts of it replaced items - slice of IndexBasedRelaceItem(s). Only nonoverlaping index pairs are supported.

func PrepareRegex

func PrepareRegex(regex string) (*regexp.Regexp, error)

func ProcessRegex

func ProcessRegex(regex *regexp.Regexp, input string, translateFunc RegexTranslateFunc) string

Types

type IndexBasedReplaceItem

type IndexBasedReplaceItem struct {
	StartIndex  int
	EndIndex    int
	Replacement string
}

type RegexTranslateFunc

type RegexTranslateFunc func(name, namespace string) types.NamespacedName

Jump to

Keyboard shortcuts

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