right()

Extracts the substring with the specified length from the right side of the given string. If the length of the string is shorter than the specified length, this returns the entire string. If the argument is null, this returns null, and if it receives a value other than the string, it evaluates that value after converting it to a string.

Syntax

right(EXPR, LENGTH)
Required Parameter
STR_EXPR
Source string expression
LENGTH
Number of characters to be extracted. The function returns the string after truncating as many characters from the right of the string as you specified. If the length of the string is shorter than the specified length, the function returns the entire string. You can only provide constants greater than or equal to 0.

Usage

json "{}" 
| eval right=right("0123456789", 4)
  => "6789"

json "{}" 
| eval right=right("0123456789", 11)
  => "0123456789"

json "{}" 
| eval right=right("0123456789", 0)
  => ""

json "{}" 
| eval right=right(1234, 2)
  => "34"

json "{}" 
| eval right=right(1.23, 3)
  => ".23"

json "{}" 
| eval right=right(null, 3)
  => null