Skip to content

Commit

Permalink
Extract parameter name without any firm pattern.
Browse files Browse the repository at this point in the history
We want to extract everything that `NAME` contains in (`$param.<NAME> | $param.<NAME>[*]`)
or (`param["<NAME>"] | $param["<NAME>"][*]`) or (`param['NAME'][*] | $param['<NAME>'][*]`).
We dont want to enforce the pattern that it should follow. That part should be done by
`Step 1` in #4799 (comment)

The regex pattern substitution `.*?(\[\*\])?` matches and extracts everything that is
contained in `<NAME>` or `<NAME>[*]`.
  • Loading branch information
chitrangpatel committed May 18, 2022
1 parent 33b3eac commit ae78819
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/substitution/substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
"knative.dev/pkg/apis"
)

const parameterSubstitution = `[_a-zA-Z][_a-zA-Z0-9.-]*(\[\*\])?`

const parameterSubstitution = `.*?(\[\*\])?`
const braceMatchingRegex = "(\\$(\\(%s(\\.(?P<var1>%s)|\\[\"(?P<var2>%s)\"\\]|\\['(?P<var3>%s)'\\])\\)))"

// ValidateVariable makes sure all variables in the provided string are known
Expand Down

0 comments on commit ae78819

Please sign in to comment.