Find

Find the first instance of a string within another string.

To do a more complex search, such as looking for a string that matches a pattern, use the Find Pattern function card instead.

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

Output

Field Definition Type
position

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

Returns -1 if no match is found.

Number

Example

If the input look in field contains This is a test, and:

  • If look for contains T, then position returns 0 (first position, where counting starts with 0).

  • If look for contains test, then position returns 10 (11th position of the first letter of a matching string).

  • If look for contains hello, then position returns -1 (no match found).

Related topics

Functions in Workflows

About the elements of Okta Workflows