code: func CompileRegex(tpl string, delimiterStart, delimiterEnd byte) (*regexp.Regexp, error) {
  	// Check if it is well-formed.
  	idxs, errBraces := delimiterIndices(tpl, delimiterStart, delimiterEnd)
  	if errBraces != nil {
  		return nil, errBraces
  	}
  	varsR := make([]*regexp.Regexp, len(idxs)/2)
  	pattern := bytes.NewBufferString("")
  	pattern.WriteByte('^')
  
  	var end int
  	var err error
  	for i := 0; i < len(idxs); i += 2 {
  		// Set all values we are interested in.
  		raw := tpl[end:idxs[i]]
  		end = idxs[i+1]
  		patt := tpl[idxs[i]+1 : end-1]
  		// Build the regexp pattern.
  		varIdx := i / 2
  		fmt.Fprintf(pattern, "%s(%s)", regexp.QuoteMeta(raw), patt)
  		varsR[varIdx], err = regexp.Compile(fmt.Sprintf("^%s$", patt))
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	// Add the remaining.
  	raw := tpl[end:]
  	pattern.WriteString(regexp.QuoteMeta(raw))
  	pattern.WriteByte('$')
  
  	// Compile full regexp.
  	reg, errCompile := regexp.Compile(pattern.String())
  	if errCompile != nil {
  		return nil, errCompile
  	}
  
  	return reg, nil
  }
docs: // 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")