filter.Regexp() Does Not Work As Expected
spencerhance opened this issue · 2 comments
spencerhance commented
filter.Regexp()
uses eq
for regex's when it really should be ~
. eq
or =
only do exact matches and a regex actually won't work here.
https://cloud.google.com/sdk/gcloud/reference/topic/filters
case regexpEquals:
// GCE API maps regexp comparison to 'eq'
op = "eq"
Snippet from filter.go
Since there may be code that relies on this behavior, I think realistically we should some additional functions to support all the other match operators (<, <=, >=, > ~, !~
) and deprecate filter.Regexp()
and filter.NotRegexp()
spencerhance commented
Actually, testing out on gcloud
I don't even think the current operators in filter.go
work at all, and I think they are no longer supported.
bowei commented
Can you check in a script that demonstrates this? It will also depend on the resource that you are looking at potentially.