SEBA-804 Add filter options for regex and contains
Change-Id: Ifa3d29d7db7b07f00a0c81e01602088752eac884
diff --git a/internal/pkg/commands/orm.go b/internal/pkg/commands/orm.go
index d09f15d..eb7d64f 100644
--- a/internal/pkg/commands/orm.go
+++ b/internal/pkg/commands/orm.go
@@ -66,6 +66,10 @@
return strings.TrimSpace(query[2:]), "EQUAL", true, nil
} else if strings.HasPrefix(query, "==") {
return "", "", false, corderrors.NewInvalidInputError("Operator == is now allowed. Suggest using = instead.")
+ } else if strings.HasPrefix(query, "~=") {
+ return strings.TrimSpace(query[2:]), "REGEX", false, nil
+ } else if strings.HasPrefix(query, "[=") {
+ return strings.TrimSpace(query[2:]), "CONTAINS", false, nil
} else if strings.HasPrefix(query, "=") {
return strings.TrimSpace(query[1:]), "EQUAL", false, nil
} else if strings.HasPrefix(query, ">=") {
@@ -156,7 +160,7 @@
operator_pos := -1
for i, ch := range query_str {
if allow_inequality {
- if (ch == '!') || (ch == '=') || (ch == '>') || (ch == '<') {
+ if (ch == '!') || (ch == '=') || (ch == '>') || (ch == '<') || (ch == '~') || (ch == '[') {
operator_pos = i
break
}