Find Last

Search for the last match inside text, where 0 is the first position. The function card returns -1 if no match is found.

Input

Field Definition Type Required
look in Text within which a search for a string is performed. String TRUE
look for String for which a search is performed. String TRUE
right-most position Right-most position in a string value, where 0 is the first position. Number FALSE

Output

Field Definition Type
position

Position of the last match found, where 0 is the first position.

Returns -1 if no match is found.

Number

Example

If the look in field contains Mississippi, and:

  • If look for contains ss and right-most position does not contain a value, then position returns 5 (the position of the second occurrence of ss).

  • If look for contains ss and right-most position contains 4, then position returns 2 (the search is only within Missi and stops at position 4).

  • If look for contains abc, then position returns -1 (not found).

Related topics

Functions in Workflows

About the elements of Okta Workflows