String Functions
Match Functions
-
startsWith(x, term)
: Checks if the stringx
starts with the passedterm
. Matches are case-sensitive. -
endsWith(x, term)
: Checks if the stringx
ends with the passedterm
. Matches are case-sensitive. -
contains(x, term)
: Checks if the stringx
contains the passedterm
anywhere. Matches are case-sensitive. -
match(x, pattern)
ormatch(x, pattern, group)
: Checks if stringx
contains a match for givenpattern
and returns the match. If agroup
number is provided, only the matching subgroup will be returned. If no match is found, empty string is returned. See pattern-match for a variable operation that contains additional matching capabilities. -
test(x, pattern)
: Checks if stringx
contains the givenpattern
. See pattern-test for a variable operation that contains additional capabilities.
Modify Functions
-
replace(x, pattern, replacement)
: Checks stringx
for all substrings matching the givenpattern
and replaces them with the givenreplacement
. Supports backreferences like $1, $2, …. See pattern-replace for a variable operation that contains additional capabilities. -
lpad(x, length, c)
: Pads a stringx
to the left with the characterc
, so that the padded string haslength
characters. -
rpad(x, length, c)
: Pads a stringx
to the right with the characterc
, so that the padded string haslength
characters.
Misc Functions
size(x)
: Gets the length of stringx
. If x is an array, gets the number of elements in the array.
Examples
startsWith(msg, 'EX')
endsWith(msg, 'EX')
contains(msg, 'error')
match(msg, 'M\d+'')
match(msg, 'M(\d+)'', 1)
test(msg, 'M60(\s|$)')
replace(msg, 'M(\d+)', '$1')