ladon: github.com/ory/ladon/compiler Index | Files

package compiler

import "github.com/ory/ladon/compiler"

Index

Package Files

regex.go

func CompileRegex Uses

func CompileRegex(tpl string, delimiterStart, delimiterEnd byte) (*regexp.Regexp, error)

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")

Package compiler imports 3 packages (graph) and is imported by 9 packages. Updated 2018-03-01. Refresh now. Tools for package owners.