mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
2289720ba0
* add support for shallow substitution Signed-off-by: Jim Bugwadia <jim@nirmata.com> * linter issue Signed-off-by: Jim Bugwadia <jim@nirmata.com> * exclude EphemeralReport and ClusterEphemeralReport Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update codegen Signed-off-by: Jim Bugwadia <jim@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
18 lines
682 B
Go
18 lines
682 B
Go
package regex
|
|
|
|
import "regexp"
|
|
|
|
var (
|
|
// RegexVariables is the Regex for '{{...}}' at the beginning of the string, and 'x{{...}}' where 'x' is not '\'
|
|
RegexVariables = regexp.MustCompile(`(^|[^\\])(\{\{(?:\{[^{}]*\}|[^{}])*\}\})`)
|
|
|
|
// RegexReferences is the Regex for '$(...)' at the beginning of the string, and 'x$(...)' where 'x' is not '\'
|
|
RegexReferences = regexp.MustCompile(`^\$\(.[^\ ]*\)|[^\\]\$\(.[^\ ]*\)`)
|
|
|
|
// RegexEscpReferences is the Regex for '\$(...)'
|
|
RegexEscpReferences = regexp.MustCompile(`\\\$\(.[^\ \)]*\)`)
|
|
|
|
RegexVariableInit = regexp.MustCompile(`^\{\{(\{[^{}]*\}|[^{}])*\}\}`)
|
|
|
|
RegexElementIndex = regexp.MustCompile(`{{\s*elementIndex\d*\s*}}`)
|
|
)
|