Skip to content

String expressions

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

This page describes string expressions that run the same Unicode-aware logic as string Operate API operations, inside an expression tree rather than against a named bin.

Read expressions such as string_contains and string_strlen evaluate to an integer, boolean, or string. That makes them projection: they shape what a command returns for each record, in operate, in a batch, and in a query. Wrap one in comparison or logic to get the Boolean a record filter needs. They are also accepted as secondary-index filter expressions.

Comparison operators (eq, ne, gt, ge, lt, le) are not Unicode-aware: they order String values by UTF-8 bytes. string_contains can match a spelling that eq rejects. See Compare String values.

String expressions that read stored data can evaluate to unknown; see Unknown results. Invalid UTF-8 in the stored value is an additional cause specific to String.

Invalid UTF-8 behaves differently across the two surfaces: through operate a malformed bin returns AS_ERR_INVALID_ENCODING, while in a filter expression it evaluates to unknown and the record is silently excluded from results. See String operations and UTF-8 validation.

A string operand is a bin, read with bin_str, or any expression that evaluates to a string.

When to use expressions versus Operate API

Operations and expressions covers the general split: an operation changes what is stored, while an expression produces a value to filter on, project, or store. Two cases are particular to String.

For worked examples, see string examples.

Modify expressions return a value

String modify operations write the bin and return nothing. Every modify operation grouped under Modify below instead evaluates to the transformed string without writing it back. Use them to project or compare a normalized value, and use the Operate API when you need to persist the change.

Reaching a String nested in a List or Map

Use a context path on the String Operate API, or compose string expressions with list or map expressions. See Strings nested in a List or Map below for a worked example.

Naming differences from AEL text

Every Operate API string operation has an expression form, but a few are spelled differently in AEL text than in the client builders, and a few have no AEL function at all:

  • insert is splice in AEL, which disambiguates it from the list and map insert functions. The client helpers keep the insert name.
  • byte_length is bytesLength in AEL. The client helpers keep the byte_length name.
  • to_double is toFloat and to_integer is toInt in AEL, which names them after the AEL type rather than the client one. Pin the receiver before either, as in $.rate:STRING.toFloat(), so the compiler parses the string rather than casting a number.
  • append, prepend, concat have no AEL function. AEL concatenates with the type-directed + operator. The client helpers expose string_append, string_prepend, and string_concat for consistency with the Operate API.
  • regex_compare has no AEL function either. AEL matches with the infix =~ operator and a regex literal, written expr =~ /pattern/flags. The client helpers expose string_regex_compare.

regexReplace replaces only the first match unless the pattern carries the g flag, written /pattern/g. The client helpers replace all matches when passed the GLOBAL regex flag. AEL writes flags as letters on the regex literal rather than as a bit field, and takes a subset of the flags the builders do — see Regex flags for the mapping and for which are valid where.

These names apply to AEL text. For AEL syntax, see the AEL reference.

Migration from cmp_regex

Prefer string_regex_compare over legacy cmp_regex. The legacy form uses POSIX regex and is not Unicode-compatible.

Strings nested in a List or Map

Nest a string expression inside a list or map expression to reach a String inside a CDT. The collection expression projects the value, and the string expression transforms it.

The Operate API reaches the same values through a context path and writes the result back in place. Use expressions when the result feeds a filter, when several operations compose into one value, or for expression_read projections.

This reaches vehicles[0].make in the sample data from Working with nested collection data types and uppercases it, so evaluating it against that record yields "TOYOTA".

The two SDKs take AEL text, where the path does the navigating: select_from() and selectFrom() document it as their primary input. The other clients compose the same thing from builders — the list getter projects the Map, the map getter projects the String, and the string expression transforms it. Rust can also compile AEL, with from_ael, but its read operation takes a built expression.

// AEL text, which selectFrom() and where() take directly.
String exp = "($.vehicles.[0].make:STRING).upper()";

Run it like any other expression on this page: as a filter, or as a computed bin through an operation expression.

In AEL the parentheses are load-bearing, and so is the :STRING pin. A string transform applied to a path — $.vehicles.[0].make:STRING.upper() — is a modify terminal, and evaluates to the whole vehicles list with that element transformed. Parenthesising the path first makes it a value, so the expression evaluates to the string alone. Without the type pin the server cannot infer the type and rejects the expression.

to_string is the one operation with no Operate API context path. Project the nested value with a list or map getter and pass it as the source expression.

Modify

string_append

create_only update_only no_fail
string_append(policy, value, bin)
Description

Returns the string with value added to the end. Unlike the append Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no append function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

valuestring

Text to add to the end of the string. A single value, not a list.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

// AEL has no append function; it concatenates with +.
String exp = "$.log:STRING + ' line'";

string_case_fold

update_only no_fail
string_case_fold(policy, bin)
Description

Returns the Unicode case-folded form of a string expression, for case-insensitive comparison. Unlike the case_fold Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.name:STRING.caseFold()";

string_concat

create_only update_only no_fail
string_concat(policy, values, bin)
Description

Returns the string with values joined onto the end, in order. Unlike the concat Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no concat function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

valuesany

A list of strings to join onto the end, in order. The server operation always takes a list, so a single-value caller wraps it in a one-element list. Python accepts a list only, and the C client also provides a single-value form, as_exp_string_concat, alongside as_exp_string_concat_list.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

// AEL has no concat function; it concatenates with +.
String exp = "$.tags:STRING + 'extra'";

string_insert

create_only update_only no_fail
string_insert(policy, offset, value, bin)
Description

Returns the string with value inserted at codepoint offset. Unlike the insert Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text calls this splice to disambiguate from the list and map insert functions. The Java, Python, and C helpers keep the insert name for consistency with the Operate API.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

offsetinteger

Codepoint index at which to insert. Negative values count from the end of the string. Out-of-range values are clamped to [0, length], so an offset equal to the length appends.

valuestring

Text to insert.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

// insert is splice in AEL, to avoid the list and map insert.
String exp = "$.text:STRING.splice(offset: 1, value: 'oh')";

string_lower

update_only no_fail
string_lower(policy, bin)
Description

Returns the lowercase form of a string expression. Unlike the lower Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.email:STRING.lower()";

string_normalize_nfc

update_only no_fail
string_normalize_nfc(policy, bin)
Description

Returns the Unicode NFC-normalized form of a string expression. Already-normalized strings are unchanged. Unlike the normalize_nfc Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin. Use this so mixed NFC and NFD spellings compare equal under eq. See Compare String values.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.name:STRING.normalizeNFC()";

string_overwrite

create_only update_only no_fail
string_overwrite(policy, offset, value, bin)
Description

Returns the string with the codepoint range starting at offset overwritten by value. The result grows beyond the original length when value extends past the end. Unlike the overwrite Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

offsetinteger

Codepoint index at which to start overwriting. Negative values count from the end of the string, as they do for string_insert, string_char_at, string_substr, and string_snip. The resolved index must satisfy 0 <= offset < length. Outside that range the expression returns an error rather than being clamped. On an empty source string the only accepted offset is 0.

valuestring

Replacement text.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.text:STRING.overwrite(offset: 4, value: 'bleh')";

string_pad_end

create_only update_only no_fail
string_pad_end(policy, target_length, pad_string, bin)
Description

Returns the string padded at the end to target_length using pad_string. No change is made when the source is already at or above the target length. Unlike the pad_end Operate API operation, the expression form yields the padded string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

target_lengthinteger

Minimum codepoint length after padding.

pad_stringstring

Padding string.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.id:STRING.padEnd(length: 6, pad: '0')";

string_pad_start

create_only update_only no_fail
string_pad_start(policy, target_length, pad_string, bin)
Description

Returns the string padded at the start to target_length using pad_string. No change is made when the source is already at or above the target length. Unlike the pad_start Operate API operation, the expression form yields the padded string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

target_lengthinteger

Minimum codepoint length after padding.

pad_stringstring

Padding string.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.id:STRING.padStart(length: 6, pad: '0')";

string_prepend

create_only update_only no_fail
string_prepend(policy, value, bin)
Description

Returns the string with value added to the start. Unlike the prepend Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin. AEL text has no prepend function, and concatenates with the type-directed + operator instead. The Java, Python, and C helpers expose a named builder for consistency with the Operate API.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

valuestring

Text to add to the start of the string. A single value, not a list.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

// AEL has no prepend function; it concatenates with +.
String exp = "'prefix: ' + $.log:STRING";

string_regex_replace

update_only no_fail
string_regex_replace(policy, pattern, replacement, regex_flags, bin)
Description

Returns the string with the first regex match replaced by replacement, or every match when the GLOBAL flag is set. Unlike the regex_replace Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write regex_flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

patternstring literal

Regular expression pattern.

replacementstring literal

Replacement text.

regex_flagsinteger literal

Bit field of regex regex_flags on the six client-builder tabs, combinable with bitwise OR. Defaults to none, which replaces only the first match; GLOBAL (16) replaces every match. The two SDK tabs take AEL text, which has no regex_flags argument at all — regex_flags there are letters appended to the regex literal, as in /\d+/g. For the values, their effects, the AEL letters, and why these must not be confused with the write policy above, see Regex flags.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Without GLOBAL, only the first match is replaced. Every client takes the policy first, the operands next, and the source string last.

// The /g flag replaces every match; without it only the first is replaced.
String exp = "$.text:STRING.regexReplace(pattern: /\\d+/g, replace: '')";

string_repeat

create_only update_only no_fail
string_repeat(policy, count, bin)
Description

Returns the string repeated count times. Unlike the repeat Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

countinteger

Number of times to repeat the string. Must be non-negative. A negative count returns an error. A count of 0 yields the empty string.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.unit:STRING.repeat(3)";

string_replace

update_only no_fail
string_replace(policy, find, replace, bin)
Description

Returns the string with the first occurrence of find replaced by replace. Unlike the replace Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

findstring literal

Substring to replace.

replacestring literal

Replacement text.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.msg:STRING.replace(find: 'old', replace: 'new')";

string_replace_all

update_only no_fail
string_replace_all(policy, find, replace, bin)
Description

Returns the string with every occurrence of find replaced by replace. Unlike the replace_all Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

findstring literal

Substring to replace.

replacestring literal

Replacement text.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.msg:STRING.replaceAll(find: 'old', replace: 'new')";

string_snip

update_only no_fail
string_snip(policy, from[, to], bin)
Description

Returns the string with the codepoint range from from (inclusive) to to (exclusive) removed. Unlike the snip Operate API operation, the expression form yields the new string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

frominteger

Start codepoint index (inclusive). Negative values count from the end of the string. Out-of-range values are clamped to [0, length].

tointeger

End codepoint index (exclusive). Negative values count from the end of the string. Out-of-range values are clamped to [0, length]. Optional, and defaults to the string’s codepoint length, removing everything from from to the end of the string.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first, the operands next, and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.text:STRING.snip(from: 6, to: 9)";

string_trim

update_only no_fail
string_trim(policy, bin)
Description

Returns the string with leading and trailing Unicode whitespace removed. Unlike the trim Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.email:STRING.trim()";

string_trim_end

update_only no_fail
string_trim_end(policy, bin)
Description

Returns the string with trailing Unicode whitespace removed. Unlike the trim_end Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.email:STRING.trimEnd()";

string_trim_start

update_only no_fail
string_trim_start(policy, bin)
Description

Returns the string with leading Unicode whitespace removed. Unlike the trim_start Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.email:STRING.trimStart()";

string_upper

update_only no_fail
string_upper(policy, bin)
Description

Returns the uppercase form of a string expression. Unlike the upper Operate API operation, the expression form yields the transformed string as a value instead of writing it back to the bin.

Arguments
NameTypeDescription
policyString policy

Write flags for the transform. Optional, and defaults to none. With NO_FAIL, a failure that would abort the transform instead yields the source string unchanged, so the expression still produces a value. See Operation flags for which failures it suppresses.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the policy first and the source string last. Go and Rust take the source string second, right after the policy.

String exp = "$.name:STRING.upper()";

Read

string_b64_decode

string_b64_decode(bin)
Description

Decodes a base64-encoded string expression into a Blob.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
blob
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

String exp = "$.encoded:STRING.b64Decode()";

string_byte_length

string_byte_length(bin)
Description

Returns the number of UTF-8 bytes in a string expression.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
integer
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

// byte_length is bytesLength in AEL.
String exp = "$.email:STRING.bytesLength()";

string_char_at

string_char_at(index, bin)
Description

Returns the single-codepoint substring at index from a string expression. Negative values count from the end of the string.

Arguments
NameTypeDescription
indexinteger

Codepoint index. Negative values count from the end of the string, so -1 selects the last codepoint.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.email:STRING.charAt(index: -1)";

string_contains

string_contains(needle, bin)
Description

Returns whether a string expression contains needle, respecting Unicode canonical equivalence.

Arguments
NameTypeDescription
needlestring

Substring to search for.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.email:STRING.contains(needle: '@company.com')";

string_ends_with

string_ends_with(suffix, bin)
Description

Returns whether a string expression ends with suffix.

Arguments
NameTypeDescription
suffixstring

Substring the value must end with.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.email:STRING.endsWith('.com')";

string_find

string_find(needle[, occurrence], bin)
Description

Returns the codepoint index of needle in a string expression, or -1 if not found.

Arguments
NameTypeDescription
needlestring

Substring to search for.

occurrenceinteger

1-based match number. Negative values count from the end of the string. Must be non-zero. Optional, and defaults to 1 (first match).

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
integer
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.email:STRING.find(needle: '@', occurrence: 1)";

string_is_lower

string_is_lower(bin)
Description

Returns whether a string expression is lowercase: it holds no uppercase letter and at least one lowercase letter. Digits, spaces, and punctuation are ignored rather than counted against the value, so a non-empty value holding no cased letter returns false. An empty string returns true.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

String exp = "$.code:STRING.isLower()";

string_is_numeric

string_is_numeric([numeric_type, ]bin)
Description

Returns whether a string expression belongs to the requested numeric class.

Arguments
NameTypeDescription
numeric_typeinteger literal

Numeric class to test for: 0 = ANY (int-class or float-class, the default), 1 = INT (optional sign then digits only, must fit int64), 2 = FLOAT (must contain a literal . followed by at least one digit, and must fit double). Constants are NumericType in Python, StringNumericType in Java, and as_string_numeric_type in C. Optional, and defaults to 0 (ANY).

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operand first and the source string last, while Go and Rust take the source string first. Float-class matching requires a literal ., so scientific-notation literals such as 1e5 match none of the three classes, including ANY.

String exp = "$.amount:STRING.isNumeric()";

string_is_upper

string_is_upper(bin)
Description

Returns whether a string expression is uppercase: it holds no lowercase letter and at least one uppercase letter. Digits, spaces, and punctuation are ignored rather than counted against the value, so a non-empty value holding no cased letter returns false. An empty string returns true.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

String exp = "$.code:STRING.isUpper()";

string_regex_compare

string_regex_compare(pattern, regex_flags, bin)
Description

Returns whether a string expression matches pattern, using ICU regular expression syntax. Prefer over legacy cmp_regex.

Arguments
NameTypeDescription
patternstring

ICU regular expression to match. It is evaluated per record, so it can come from a bin or from another expression, not only from a constant.

regex_flagsinteger literal

Bit field of regex regex_flags on the six client-builder tabs, combinable with bitwise OR; GLOBAL is not valid here. The two SDK tabs take AEL text, which has no regex_flags argument at all — regex_flags there are letters appended to the regex literal, as in /^555.*/i. For the values, their effects, and the AEL letters, see Regex flags.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Python is the exception here, taking the source second, as in RegexCompare(pattern, bin, regex_flags).

// AEL has no regex_compare function; it matches with =~ and a regex literal.
String exp = "$.phone:STRING =~ /^555.*/";

string_split

string_split([separator, ]bin)
Description

Returns a list of strings by splitting a string expression on separator.

Arguments
NameTypeDescription
separatorstring

Delimiter string. Optional. When omitted, the string is split into one element per Unicode codepoint rather than returned unsplit.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
list
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.tags:STRING.split(',')";

string_starts_with

string_starts_with(prefix, bin)
Description

Returns whether a string expression starts with prefix.

Arguments
NameTypeDescription
prefixstring

Substring the value must begin with.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
boolean
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.sku:STRING.startsWith('A-')";

string_strlen

string_strlen(bin)
Description

Returns the codepoint length of a string expression.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
integer
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

String exp = "$.name:STRING.strlen()";

string_substr

string_substr(from[, to], bin)
Description

Returns a substring by codepoint range from a string expression.

Arguments
NameTypeDescription
frominteger

Start codepoint index (inclusive). Negative values count from the end of the string. Out-of-range values are clamped to [0, length].

tointeger

End codepoint index (exclusive). Negative values count from the end of the string. Out-of-range values are clamped to [0, length]. Optional, and defaults to the string’s codepoint length, returning the substring from from to the end of the string.

binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections. Most clients take the operands first and the source string last. Go and Rust take the source string first.

String exp = "$.email:STRING.substr(from: 0, to: 10)";

string_to_blob

string_to_blob(bin)
Description

Returns the UTF-8 bytes of a string expression as a Blob.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
blob
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

String exp = "$.payload:STRING.toBlob()";

string_to_double

string_to_double(bin)
Description

Parses a string expression as a float. Supports scientific notation.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
float
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

// to_double is toFloat in AEL.
String exp = "$.rate:STRING.toFloat()";

string_to_integer

string_to_integer(bin)
Description

Parses a string expression as a signed integer.

Arguments
NameTypeDescription
binstring

String bin to operate on, or any expression that evaluates to a string.

Returns
integer
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

// to_integer is toInt in AEL.
String exp = "$.count:STRING.toInt()";

Type conversion

to_string

to_string(value)
Description

Converts an integer, float, boolean, blob, or string expression to its string representation. Unlike the other entries on this page, to_string is a standalone expression operator rather than a member of the string expression module, which is why each client spells it without the module prefix.

Arguments
NameTypeDescription
valueany

Integer, float, boolean, blob, or string expression to convert.

Returns
string
Introduced
8.2.0
Operate API operation
Example

Compose string expressions in query filters or operate read projections.

// Pin the receiver type: toString formats whatever the bin holds.
String exp = "$.numbin:INT.toString()";