Operator

Overview

Operators are used when setting filter conditions and describe the relationship between a Property Key and a Property Value.

Hackle's Data Analytics provides the operators listed below. You must select the appropriate operator based on the type of the Property Value for the selected Property Key.

Operators

Operator
Number of selectable property values

= (is one of)

Multiple values

≠ (is not one of)

Multiple values

> (greater than)

Single value

≥ (greater than or equal to)

Single value

< (less than)

Single value

≤ (less than or equal to)

Single value

{=} (exactly matches)

Multiple values

{≠} (does not exactly match)

Multiple values

∋ (contains one of)

Multiple values

∌ (does not contain any of)

Multiple values

starts with one of

Multiple values

does not start with any of

Multiple values

ends with one of

Multiple values

does not end with any of

Multiple values

(.*) matches one of the following regex

Single value

!(.*) does not match any of the following regex

Single value

Example

To select users who live in a metropolitan city, since they must live in one of the six metropolitan cities, you can define the filter as follows:

circle-check

= (is one of)

Checks whether the property exactly matches any one of the user-entered values.

  • Single Value — User input: ["foo", "bar"]

    • foo → O

    • bar → O

    • qux → X

  • Array Value — User input: ["foo", "bar"]

    • ["foo", "bar"] → O

    • ["foo", "qux"] → O

    • ["fo", "ba"] → X

    • ["qux"] → X

≠ (is not one of)

The opposite of =.

  • Single Value — User input: ["foo", "bar"]

    • foo → X

    • bar → X

    • qux → O

  • Array Value — User input: ["foo", "bar"]

    • ["foo", "bar"] → X

    • ["foo", "qux"] → X

    • ["fo", "ba"] → O

    • ["qux"] → O

> (greater than)

Checks whether the property value is greater than the operand.

  • Single Value — User input: 10

    • 11 → O

    • 10 → X

    • 9 → X

  • Array Value — User input: 10 (checks whether at least one value in the array is greater)

    • [8, 9, 10] → X

    • [9, 10, 11] → O

    • [10, 11, 12] → O

≥ (greater than or equal to)

Checks whether the property value is greater than or equal to the operand.

  • Single Value — User input: 10

    • 11 → O

    • 10 → O

    • 9 → X

  • Array Value — User input: 10

    • [8, 9, 10] → O

    • [9, 10, 11] → O

    • [10, 11, 12] → O

< (less than)

Checks whether the property value is less than the operand.

  • Single Value — User input: 10

    • 11 → X

    • 10 → X

    • 9 → O

  • Array Value — User input: 10

    • [8, 9, 10] → O

    • [9, 10, 11] → O

    • [10, 11, 12] → X

≤ (less than or equal to)

Checks whether the property value is less than or equal to the operand.

  • Single Value — User input: 10

    • 11 → X

    • 10 → O

    • 9 → O

  • Array Value — User input: 10

    • [8, 9, 10] → O

    • [9, 10, 11] → O

    • [11, 12, 13] → X

{=} (exactly matches)

Checks whether the selected property group exactly matches the operand.

  • Single Value — User input: ["foo"]

    • foo → O

    • foo1 → X

    • bar → X

  • Single Value — User input: ["foo", "bar"]

    • foo → O

    • foo1 → X

    • bar → O

  • Array Value — User input: ["foo", "bar"]

    • ["foo", "bar"] → O

    • ["foo", "foo1"] → X

    • ["foo"] → X

{≠} (does not exactly match)

The opposite of {=}.

  • Single Value — User input: ["foo"]

    • foo → X

    • foo1 → O

    • bar → O

  • Single Value — User input: ["foo", "bar"]

    • foo → X

    • foo1 → O

    • bar → X

  • Array Value — User input: ["foo", "bar"]

    • ["foo", "bar"] → X

    • ["foo", "foo1"] → O

    • ["foo"] → O

∋ (contains one of)

Checks whether the property partially matches (as a substring) any one of the user-entered values.

  • Single Value — User input: ["fo", "ar"]

    • foo → O

    • bar → O

    • qux → X

  • Array Value — User input: ["fo", "ar"]

    • ["foo", "bar"] → O

    • ["bar", "qux"] → O

    • ["qux"] → X

∌ (does not contain any of)

The opposite of ∋.

  • Single Value — User input: ["fo", "ar"]

    • foo → X

    • bar → X

    • qux → O

  • Array Value — User input: ["fo", "ar"]

    • ["foo", "bar"] → X

    • ["bar", "qux"] → X

    • ["qux"] → O

starts with one of

Checks whether the property starts with any one of the elements in the user input. The element in the user input must match the beginning of the property.

  • Single Value — User input: ["fo", "ba"]

    • foo → O

    • bar → O

    • qux → X

  • Array Value — User input: ["fo", "ba"]

    • ["foo", "bar"] → O

    • ["bar", "qux"] → O

    • ["qux"] → X

does not start with any of

The opposite of "starts with one of".

  • Single Value — User input: ["fo", "ba"]

    • foo → X

    • bar → X

    • qux → O

  • Array Value — User input: ["fo", "ba"]

    • ["foo", "bar"] → X

    • ["bar", "qux"] → X

    • ["qux"] → O

ends with one of

Checks whether the property ends with any one of the elements in the user input. The element in the user input must match the end of the property.

  • Single Value — User input: ["oo", "ar"]

    • foo → O

    • bar → O

    • qux → X

  • Array Value — User input: ["oo", "ar"]

    • ["foo", "bar"] → O

    • ["bar", "qux"] → O

    • ["qux"] → X

does not end with any of

The opposite of "ends with one of".

  • Single Value — User input: ["oo", "ar"]

    • foo → X

    • bar → X

    • qux → O

  • Array Value — User input: ["oo", "ar"]

    • ["foo", "bar"] → X

    • ["bar", "qux"] → X

    • ["qux"] → O

(.*) matches one of the following regex

Checks whether the property matches via regex any one of the user-entered values.

  • Single Value — User input: ["f.*", "\d+"]

    • foo → O

    • 1 → O

    • qux → X

  • Array Value — User input: ["f.*", "\d+"]

    • ["foo", "bar"] → X

    • ["bar", "qux"] → X

    • ["qux"] → O

!(.*) does not match any of the following regex

The opposite of "(.*)".

  • Single Value — User input: ["f.*", "\d+"]

    • foo → X

    • 1 → X

    • qux → O

  • Array Value — User input: ["f.*", "\d+"]

    • ["foo", "1"] → X

    • ["1", "qux"] → X

    • ["qux"] → O

Regular Expressions

Regular expressions enable more sophisticated pattern matching for patterns that cannot be expressed with string operators.

For example, if you want to select only the set of URL paths that match /api/v1/items/{number}, this is not possible with existing string operators because string operators cannot single out only numbers.

Cases that cannot be solved with string operators

  • Contains numbers

  • Contains only letters

  • Ends with only numbers

  • Starts with only numbers

  • Contains a specific character and ends with numbers

For basic string operations, we recommend using the following operators:

  • starts with one of

  • ends with one of

  • contains one of

Useful regex syntax

Symbols

  1. \d+ means consecutive digits. It can represent any number regardless of the number of digits.

  2. \D+ means consecutive non-digit characters, i.e., it can represent a string.

  3. ^ indicates the start of a string.

  4. ^a means a string that starts with a.

  5. $ indicates the end of a string.

  6. a$ means a string that ends with a.

  7. {n} means repeated n times consecutively.

  8. \d{2} means a two-digit number.

Partial match vs full match

Regular expressions provide partial matching by default.

  • Partial match

    • /v1/

      • /api/v1/items/1 : ✅

      • /api/v1/items/apples/1 : ✅

      • For a full match, use the start and end symbols.

    • ^/api/v1/items/1$

      • /api/v1/items/1 :

      • /api/v1/items/apples/1 :

URL path matching

  • A specific path that ends with a number (e.g., an ID)

    • /api/v1/items/\d+

      • /api/v1/items/1 :

      • /api/v1/items/apples/1 :

    • /api/v1/items/apples/\d+

      • /api/v1/items/apples/1 :

      • /api/v1/items/bananas/1 :

  • Contains a specific string in the path

    • /v1/

      • /api/v1/items/1 :

      • /api/v2/items/1 :

  • Contains a specific type of string in the path and ends with a number

    • /api/v1/items/(apples|bananas)/\d+

      • /api/v1/items/apples/1 :

      • /api/v1/items/bananas/1 :

      • /api/v1/items/oranges/1 :

Other string matching To select only addresses that match a specific format using event properties, you can configure as follows:

  • Yeoksam-ro (number) (number)-dong (number)-ho

    • 역삼로 \d+ \d+동 \d+호

      • 역삼로 301 101동 101호 :

      • 역삼로 301 1003호 :

      • 테헤란로 301 101동 101호 :

You can also select only people who live on the 1st floor. \d{n} means a digit repeated n times.

  • 1\d{2}호

    • 101호 ~ 199호 :

Last updated