Cloud

Overview

Use string functions to analyze and manipulate string values. Redpanda SQL supports these string related functions and operators:

String functions

Function Description

length()

Returns the number of characters in a string

lower()

Makes string lowercase

upper()

Makes string upper case

starts_with()

Checks if a string starts with a specified substring

ends_with()

Checks if a string ends with a specified substring

concat()

Adds two or more strings together

SUBSTRING

Extracts a substring from a string. SUBSTR is an alias.

strpos()

Finds the position at which the substring starts within the string

regexp_match()

Matches a POSIX regular expression pattern to a string

regexp_replace()

Substitutes new text for substrings that match POSIX regular expression patterns

replace()

Finds and replace occurrences of a substring in a string

POSITION

Returns the position of the first occurrence of a substring in a string

String operators

Operator Description

text ~ text → boolean

Returns true if the first argument matches the pattern of the second argument in case-sensitive match.

text ~* text → boolean

Returns true if the first argument matches the pattern of the second argument in a case-insensitive match.

text !~ text → boolean

Returns true if the first argument does not match the pattern of the second argument in case-sensitive match.

text !~* text → boolean

Returns true if the first argument does not match the pattern of the second argument in a case-insensitive match.