code: func ValidatePattern(p string, val string) bool {
  	knownPatternsLock.RLock()
  	r, ok := knownPatterns[p]
  	knownPatternsLock.RUnlock()
  	if !ok {
  		r = regexp.MustCompile(p) // DSL validation makes sure regexp is valid
  		knownPatternsLock.Lock()
  		knownPatterns[p] = r
  		knownPatternsLock.Unlock()
  	}
  	return r.MatchString(val)
  }
docs: // ValidatePattern returns an error if val does not match the regular expression p.
  // It makes an effort to minimize the number of times the regular expression needs to be compiled.