Returns the starting position of the first instance of needle in haystack. Returns null if needle is not in haystack.
By default, this function counts from the beginning of the string, but you can specify a starting position.
Always counts in the natural direction of the advertiser’s locale. For example, if the advertiser’s language is English, this function counts from left to right.
search(needle, haystack[, starting-position])
needle and haystack can be any of the following:
- A String constant, such as "GDN".
- A Search Ads 360 variable that is a String, such as
Engine_status, and so on.
- An expression or formula column that returns a String.
starting-position is an optional positive integer that indicates where to start searching in haystack.
A value of
1 searches from the beginning of haystack (this is the same as the default behavior). A value of
4 starts searching from the 4th character.
Text searches are case insensitive.
If you include an expression or formula column in this function, the expression or formula column could evaluate to an empty string.
Be aware that searching for an empty string always returns 1. That is,
search("", "GDN") evaluates to 1.
[search("a","cowabunga")]returns 4, which is the location of the first
[search("a","cowabunga", 5)]returns 9, which is the location of the first
athat occurs if you start counting from the 5th character.
search("a","cowabunga", 5)starts searching
cowabungafrom the 5th character, which is
b. The function finds an
ain position 9 of