SEARCH finds the first appearance of a string within a block of text.

Function category: Text


SEARCH(arg1, arg2, [arg3])




String that is searched.


Block of text to be search.


Optional. Place to begin searching for the string.


Let's say we're given a response with the following vehicle information:

"description":"The car was still functional, but had a bad radiator, and was in a bad condition."

Example 1: Find location of a string in a block of text

If we know that the value for the description key has a standard structure and uses standardized terminology, we can using SEARCH to find the string "bad" using this function.

# Search for the position of a string in an object
SEARCH("bad", data.mechanic_reports.vehicle_1.description)
# Returns 41
# This is the position in the string
# at which arg1 first appears

Example 2: Find location after a starting point

We can also add the third, optional argument, to search for a specific starting point using this function.

# Search for starting point of of a string in an object
SEARCH("bad", data.mechanic_reports.vehicle_1.description, 41)
# Returns 66