String functions
substring(string, start position)
Returns a substring of the given value starting at start position.
Function signature
substring(string: string, start position: number): string
The start position starts at the index 1. The last position is -1.
Examples
substring("foobar", 3)
// "obar"
substring("foobar", -2)
// "ar"
substring(string, start position, length)
Returns a substring of the given value, starting at start position with the given length. If length is greater than
the remaining characters of the value, it returns all characters from start position until the end.
Function signature
substring(string: string, start position: number, length: number): string
The start position starts at the index 1. The last position is -1.
Examples
substring("foobar", 3, 3)
// "oba"
substring("foobar", -3, 2)
// "ba"
substring("foobar", 3, 10)
// "obar"
string length(string)
Returns the number of characters in the given value.
Function signature
string length(string: string): number
Examples
string length("foo")
// 3
upper case(string)
Returns the given value with all characters are uppercase.
Function signature
upper case(string: string): string
Examples
upper case("aBc4")
// "ABC4"
lower case(string)
Returns the given value with all characters are lowercase.
Function signature
lower case(string: string): string
Examples
lower case("aBc4")
// "abc4"
substring before(string, match)
Returns a substring of the given value that contains all characters before match.
Function signature
substring before(string: string, match: string): string
Examples
substring before("foobar", "bar")
// "foo"
substring after(string, match)
Returns a substring of the given value that contains all characters after match.
Function signature
substring after(string: string, match: string): string
Examples
substring after("foobar", "ob")
// "ar"
contains(string, match)
Returns true if the given value contains the substring match. Otherwise, returns false.
Function signature
contains(string: string, match: string): boolean
Examples
contains("foobar", "of")
// false
starts with(string, match)
Returns true if the given value starts with the substring match. Otherwise, returns false.
Function signature
starts with(string: string, match: string): boolean
Examples
starts with("foobar", "fo")
// true
ends with(string, match)
Returns true if the given value ends with the substring match. Otherwise, returns false.
Function signature
ends with(string: string, match: string): boolean
Examples
ends with("foobar", "r")
// true
matches(input, pattern)
Returns true if the given value matches the pattern. Otherwise, returns false.
Function signature
matches(input: string, pattern: string): boolean
The pattern is a string that contains a regular expression.
Examples
matches("foobar", "^fo*bar")
// true
matches(input, pattern, flags)
Returns true if the given value matches the pattern. Otherwise, returns false.
Function signature
matches(input: string, pattern: string, flags: string): boolean
The pattern is a string that contains a regular expression.
The flags can contain one or more of the following characters:
s(dot-all)m(multi-line)i(case insensitive)x(comments)
Examples
matches("FooBar", "foo", "i")
// true
replace(input, pattern, replacement)
Returns the resulting string after replacing all occurrences of pattern with replacement.
Function signature
replace(input: string, pattern: string, replacement: string): string
The pattern is a string that contains a regular expression.
The replacement can access the match groups by using $ and the number of the group, for example,
$1 to access the first group.
Examples
replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")
// "[1=ab][2=]cd"
replace("0123456789", "(\d{3})(\d{3})(\d{4})", "($1) $2-$3")
// "(012) 345-6789"
replace(input, pattern, replacement, flags)
Returns the resulting string after replacing all occurrences of pattern with replacement.
Function signature
replace(input: string, pattern: string, replacement: string, flags: string): string
The pattern is a string that contains a regular expression.
The replacement can access the match groups by using $ and the number of the group, for example,
$1 to access the first group.
The flags can contain one or more of the following characters:
s(dot-all)m(multi-line)i(case insensitive)x(comments)
Examples
replace("How do you feel?", "Feel", "FEEL", "i")
// "How do you FEEL?"
split(string, delimiter)
Splits the given value into a list of substrings, breaking at each occurrence of the delimiter pattern.
Function signature
split(string: string, delimiter: string): list<string>
The delimiter is a string that contains a regular expression.
Examples
split("John Doe", "\s" )
// ["John", "Doe"]
split("a;b;c;;", ";")
// ["a", "b", "c", "", ""]
extract(string, pattern)
Camunda Extension
Returns all matches of the pattern in the given string. Returns an empty list if the pattern doesn't match.
Function signature
extract(string: string, pattern: string): list<string>
The pattern is a string that contains a regular expression.
Examples
extract("references are 1234, 1256, 1378", "12[0-9]*")
// ["1234","1256"]
trim(string)
Camunda Extension
Returns the given string without leading and trailing spaces.
Function signature
trim(string: string): string
Examples
trim(" hello world ")
// "hello world"
trim("hello world ")
// "hello world"
uuid()
Camunda Extension
Returns a UUID (Universally Unique Identifier) with 36 characters.
Function signature
uuid(): string
Examples
uuid()
// "7793aab1-d761-4d38-916b-b7270e309894"
to base64(value)
Camunda Extension
Returns the given string encoded in Base64 format.
Function signature
to base64(value: string): string
Examples
to base64("FEEL")
// "RkVFTA=="
is blank(string)
Camunda Extension
Returns true if the given string is blank (empty or contains only whitespaces).
Function signature
is blank(string: string): boolean
Examples
is blank("")
// true
is blank(" ")
// true
is blank("hello world")
// false