SEARCH

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

Function category: Text

Syntax

SEARCH(arg1, arg2, [arg3])

Arguments

Description

arg1

String that is searched.

arg2

Block of text to be search.

arg3

Optional. Place to begin searching for the string.

Examples

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

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

{
"data":{
"mechanic_reports":{
"vehicle_1":{
"description":"The car was still functional, but had a bad radiator, and was in a bad condition."
}
}
}
}

If we know that the description attribute is going to have a standard structure and used standardized terminology, we can do a search using SEARCH. In this example, we search for the string "bad":

SEARCH("bad", data.mechanic_reports.vehicle_1.description)

This returns the following, which is the position in the string at which our arg1 first appears:

41

Example 2: Find location after a starting point

We can also add the third, optional argument, to search after a specific starting point:

SEARCH("bad", data.mechanic_reports.vehicle_1.description, 41)

This returns the following:

66