Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter.Regexp() Does Not Work As Expected #50

Open
spencerhance opened this issue Apr 21, 2021 · 2 comments
Open

filter.Regexp() Does Not Work As Expected #50

spencerhance opened this issue Apr 21, 2021 · 2 comments

Comments

@spencerhance
Copy link
Member

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 spencerhance changed the title Filter Regex Does Not Work As Expected filter.Regexp() Does Not Work As Expected Apr 21, 2021
@spencerhance
Copy link
Member Author

spencerhance commented Apr 21, 2021

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
Copy link
Member

bowei commented Apr 21, 2021

Can you check in a script that demonstrates this? It will also depend on the resource that you are looking at potentially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants