Skip to content
Docs
flero.ai

Operators

Operators are used by the If and Switch nodes to evaluate conditions. The full list, with examples.


Operator reference

Operator Meaning Works on Example
equal Strict equality Any "hello" equal "hello" → true
notEqual Strict inequality Any 5 notEqual 6 → true
greaterThan > Number, date 42 greaterThan 10 → true
lessThan < Number, date 42 lessThan 100 → true
greaterThanOrEqual >= Number, date 42 greaterThanOrEqual 42 → true
lessThanOrEqual <= Number, date 42 lessThanOrEqual 42 → true
contains Substring / element-of String, array "hello world" contains "world" → true
notContains Negation of contains String, array
startsWith Prefix match String "foobar" startsWith "foo" → true
notStartsWith Negation String
endsWith Suffix match String "file.pdf" endsWith ".pdf" → true
notEndsWith Negation String
regex Regex match String "a1b2c3" regex "^[a-z0-9]+{{CONTENT}}quot; → true
isEmpty Has no value String, array, object [] isEmpty → true
isNotEmpty Has any value String, array, object [1] isNotEmpty → true
isNull Equals null Any null isNull → true
isNotNull Not null Any 0 isNotNull → true
isTrue Equals true (boolean) Boolean true isTrue → true
isFalse Equals false (boolean) Boolean false isFalse → true

Combining conditions

If and Switch nodes let you combine multiple conditions with a combinator:

  • and, every condition must match.
  • or, at least one must match.

There's no nested grouping. For complex boolean logic, chain multiple If nodes or use a Code node.


Type coercion

The expression engine compares values strictly for equal / notEqual. 5 and "5" are not equal, different types.

If you have a string that holds a number and want to compare numerically, convert first using a Data Transform with the convert operation, or in a Code node.


Truthiness

isTrue checks for the literal boolean true, not "truthy" values. The string "true" is not the same as true. Likewise:

  • 0 is not isFalse (it's just zero).
  • "" (empty string) is not isFalse (it's isEmpty).

To check whether any value is present, use isNotEmpty / isNotNull.


Regex

The regex operator uses Dart's regex implementation (PCRE-flavoured). Flags go inside the pattern via inline (?i) for case-insensitive, (?m) for multiline:

"hello world" regex "(?i)WORLD"          → true
"line1\nline2" regex "(?m)^line2$"       → true

Escape characters that are regex-special if you mean them literally: ., *, +, ?, [, ], (, ), ^, $, \, |.


Example: If with two conditions

Condition 1:
  value1:   {{ $trigger.body.amount }}
  operator: greaterThan
  value2:   1000

Condition 2:
  value1:   {{ $trigger.body.country }}
  operator: equal
  value2:   US

Combinator: and

Connect the true output of the If to a "high-value US order" path; false to the regular path.


Example: Switch with regex cases

Switch on: {{ $trigger.body.eventType }}

Case 1: regex "^order\\."         → port: orders
Case 2: regex "^refund\\."        → port: refunds
Case 3: equal  "user.created"      → port: signup
Default                            → port: other

Tips & gotchas

  • isEmpty on a null value is technically empty, but to make intent clear, use isNull instead.
  • Regex anchors are not auto-inserted. regex "foo" matches "fooBar"; use regex "^foo{{CONTENT}}quot; for full-string match.
  • Date comparisons require both sides to be the same shape (ISO 8601 strings sort lexicographically and compare correctly, but mixing a Date object and a string won't work, convert first).
  • Performance: thousands of If nodes with regex on every iteration of a big Loop is fine, but be aware that pathological regexes (catastrophic backtracking) can stall a worker. Keep them simple.


Found something out of date? This page lives in the Flero docs content set.