String functions
CHARACTER_LENGTH(s)|CHAR_LENGTH(s)- length of string, in UTF8 characters
str [NOT] LIKE like_pattern- Returns true iff the
strmatches (/ doesn’t match) thelike_pattern.like_patterncan contain:_: matches any single character%: matches 0-n characters
str [NOT] LIKE_REGEX regex [FLAG flags]- Returns true iff the
strmatches (/ doesn’t match) theregex. See Regular expressions in XTDB for more details. REGEXP_REPLACE(s, pattern, replacement [, flags])- Replace all occurrences of
patterninswithreplacement. See Regular expressions in XTDB for more details. LOWER(str)- lower-case
OVERLAY(str PLACING replacement FROM start_pos [FOR length])- replace
lengthcharacters ofstrstarting atstart_poswithreplacementstart_pos: 1-based start positionlength: defaults to end-of-string if not provided
POSITION(search IN str [USING CHARACTERS])- position of
searchwithinstr, in characters- Return value is 1-based.
- Returns 0 if not found.
TRIM([trim_char FROM] str)|TRIM(BOTH [trim_char] FROM str)- remove any occurrences of
trim_charfrom the start and end ofstrtrim_char: single character (defaults to ‘space’).
TRIM(LEADING [trim_char] FROM str)- remove any occurrences of
trim_charfrom the start ofstrtrim_char: single character (defaults to ‘space’).
TRIM(TRAILING [trim_char] FROM str)- remove any occurrences of
trim_charfrom the end of `strtrim_char: single character (defaults to ‘space’).
OCTET_LENGTH(s)- length of string, in octets
POSITION(search IN str USING OCTETS)-
position of
searchwithinstr, in octetsReturns 0 if not found.
SUBSTRING(str FROM from_pos)|SUBSTRING(str FROM from_pos FOR length)- Returns the sub-string of the given
strfromfrom_posforlengthcharactersfrom_pos: 1-based start positionlength: defaults to end-of-string if not provided
UPPER(str)- upper-case
Regular expressions (‘regexes’) in XTDB
Section titled “Regular expressions (‘regexes’) in XTDB”XTDB regular expressions use Java’s Pattern syntax.
Supported flags (string, e.g. 'im') are as follows:
s: ‘dot’ matches any character (including line terminators)i: case insensitivem: multi-line