regexps

package
v0.0.0-...-906ada0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchString

func MatchString[T any](expr, target string) (bool, error)

Types

type CompileError

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

CompileError returned on regex compilation error

func (*CompileError) Error

func (c *CompileError) Error() string

type NoMatchFoundError

type NoMatchFoundError struct{}

NoMatchFoundError indicates no regex matches for given string

func (*NoMatchFoundError) Error

func (n *NoMatchFoundError) Error() string

type NotStructPtrError

type NotStructPtrError struct{}

NotStructPtrError returned when given target is not a truct pointer

func (*NotStructPtrError) Error

func (n *NotStructPtrError) Error() string

type ParseError

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

ParseError returned when the conversion to target struct field type has failed

func (*ParseError) Error

func (p *ParseError) Error() string

type Regexp

type Regexp[T any] struct {
	// contains filtered or unexported fields
}

func Compile

func Compile[T any](expr string) (*Regexp[T], error)

func CompileWithDefaults

func CompileWithDefaults[T any](expr string, defaults map[string]string) (*Regexp[T], error)

func MustCompile

func MustCompile[T any](expr string) *Regexp[T]

func MustCompileWithDefaults

func MustCompileWithDefaults[T any](expr string, defaults map[string]string) *Regexp[T]

func (*Regexp[T]) Find

func (r *Regexp[T]) Find(b []byte) *T

func (*Regexp[T]) FindAll

func (r *Regexp[T]) FindAll(b []byte) []*T

func (*Regexp[T]) FindAllString

func (r *Regexp[T]) FindAllString(s string) []*T

func (*Regexp[T]) FindString

func (r *Regexp[T]) FindString(s string) *T

func (*Regexp[T]) MatchString

func (r *Regexp[T]) MatchString(target string) bool

type RequiredGroupIsEmpty

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

RequiredGroupIsEmpty returned when a required group is empty in the re match

func (*RequiredGroupIsEmpty) Error

func (r *RequiredGroupIsEmpty) Error() string

type TypeNotParsableError

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

TypeNotParsableError returned when the type of struct field is not parsable

func (*TypeNotParsableError) Error

func (t *TypeNotParsableError) Error() string

type UnknownGroupError

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

UnknownGroupError returned when given regex group tag isn't exists in compiled regex groups

func (*UnknownGroupError) Error

func (u *UnknownGroupError) Error() string

Jump to

Keyboard shortcuts

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