code: func Parse(s string) (Pattern, error) {
  	switch s {
  	case "":
  		return None, nil
  	case "*":
  		return Any, nil
  	}
  
  	parts := strings.SplitN(s, ":", 2)
  	if len(parts) < 2 {
  		return Exact(s), nil
  	}
  
  	kind, value := parts[0], parts[1]
  	switch kind {
  	case "exact", "text":
  		return Exact(value), nil
  	case "regex":
  		switch value {
  		case ".", ".*":
  			return Any, nil
  		case "^$":
  			return None, nil
  		default:
  			if !strings.HasPrefix(value, "^") {
  				value = "^" + value
  			}
  			if !strings.HasSuffix(value, "$") {
  				value = value + "$"
  			}
  			r, err := regexp.Compile(value)
  			if err != nil {
  				return nil, err
  			}
  			return Regexp(r), nil
  		}
  	default:
  		return nil, fmt.Errorf("unknown pattern kind: %q", kind)
  	}
  }
docs: // Parse parses a pattern.
  //
  // Ordered by precedence, s can be:
  //
  //  - "": matches nothing
  //  - "*": matches anything
  //  - "<S>" where S does not have a colon: same as "exact:<S>"
  //  - "exact:<S>": matches only string S
  //  - "text:<S>": same as "exact:<S>" for backward compatibility
  //  - "regex:<E>": matches all strings matching regular expression E. If E
  //    does not start/end with ^/$, they are added automatically.
  //
  // Anything else will cause an error.