Documentation ¶
Overview ¶
Package compiler offers a regexp compiler which compiles regex templates to regexp.Regexp
reg, err := compiler.CompileRegex("foo:bar.baz:<[0-9]{2,10}>", '<', '>') // if err != nil ... reg.MatchString("foo:bar.baz:123") reg, err := compiler.CompileRegex("/foo/bar/url/{[a-z]+}", '{', '}') // if err != nil ... reg.MatchString("/foo/bar/url/abz")
This package is adapts github.com/gorilla/mux/regexp.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileRegex ¶
CompileRegex parses a template and returns a Regexp.
You can define your own delimiters. It is e.g. common to use curly braces {} but I recommend using characters which have no special meaning in Regex, e.g.: <, >
reg, err := compiler.CompileRegex("foo:bar.baz:<[0-9]{2,10}>", '<', '>') // if err != nil ... reg.MatchString("foo:bar.baz:123")
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.