regex

package
v0.3.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Alpha defines the alpha atom.
	// This only allows upper and lower case characters.
	Alpha = Match(`[A-Za-z]+`)

	// AlphaNumeric defines the alpha numeric atom, typically a
	// component of names. This only allows upper and lower case characters and digits.
	AlphaNumeric = Match(`[A-Za-z0-9]+`)

	// Identifier is an AlphaNumeric regexp starting with an Alpha regexp.
	Identifier = Sequence(Alpha, Match(`[A-Za-z0-9]`), Optional(Literal("+"), Alpha))
)

Match compiles the string to a regular expression.

Functions

func Anchored

func Anchored(res ...*regexp.Regexp) *regexp.Regexp

Anchored anchors the regular expression by adding start and end delimiters.

func Capture

func Capture(res ...*regexp.Regexp) *regexp.Regexp

Capture wraps the expression in a capturing group.

func Group

func Group(res ...*regexp.Regexp) *regexp.Regexp

Group wraps the regexp in a non-capturing group.

func Literal

func Literal(s string) *regexp.Regexp

Literal compiles s into a literal regular expression, escaping any regexp reserved characters.

func Optional

func Optional(res ...*regexp.Regexp) *regexp.Regexp

Optional wraps the expression in a non-capturing group and makes the production optional.

func Or

func Or(res ...*regexp.Regexp) *regexp.Regexp

Or wraps alternative regexps.

func Repeated

func Repeated(res ...*regexp.Regexp) *regexp.Regexp

Repeated wraps the regexp in a non-capturing group to get one or more matches.

func Sequence

func Sequence(res ...*regexp.Regexp) *regexp.Regexp

Sequence defines a full expression, where each regular expression must follow the previous.

Types

This section is empty.

Jump to

Keyboard shortcuts

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