Merge pull request #82928 from chendotjs/simplify-regex

simplify regexp with raw string
This commit is contained in:
Kubernetes Prow Robot
2019-09-25 11:07:02 -07:00
committed by GitHub
4 changed files with 10 additions and 8 deletions

View File

@@ -36,7 +36,7 @@ import (
utilprinters "k8s.io/kubectl/pkg/util/printers"
)
var jsonRegexp = regexp.MustCompile("^\\{\\.?([^{}]+)\\}$|^\\.?([^{}]+)$")
var jsonRegexp = regexp.MustCompile(`^\{\.?([^{}]+)\}$|^\.?([^{}]+)$`)
// RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:
// * metadata.name (no leading '.' or curly braces '{...}'