1
0
mirror of https://github.com/rancher/types.git synced 2025-07-19 15:56:26 +00:00

fix regular expression

https://github.com/rancher/rancher/issues/14939.
Problems:
we are not using lazy match to match the group (!=|=) so that "foo !=
bar` can be parsed wrongly as (foo !) (=) (bar).
Solutions:
Use lazy match to match as less as possible the characters in the first
group. Also improved the whitespace matches.
This commit is contained in:
Daishan Peng 2018-08-03 15:55:23 -07:00 committed by Craig Jellick
parent d919b35add
commit 0968d09296

View File

@ -14,7 +14,7 @@ import (
)
var (
exprRegexp = regexp.MustCompile("^(.*)(=|!=|<|>| in | notin )(.*)$")
exprRegexp = regexp.MustCompile("^(.*?)\\s*(=|!=|<|>|in|notin)\\s*(.*)$")
)
type SchedulingMapper struct {