Notification

Welcome to the help center for Search Ads 360, a platform for managing search marketing campaigns.  While the help center is available to the public, access to the Search Ads 360 product is available only to subscribing customers who are signed in. To subscribe or find out more, contact our sales team.

search

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.

Syntax

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 Keyword, Campaign, 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.

Case insensitive

Text searches are case insensitive.

Empty character

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.

Examples

  • [search("cow","cowabunga")] returns 1.

  • [search("abunga","cowabunga")] returns 4.

  • [search("a","cowabunga")] returns 4, which is the location of the first a.

  • [search("a","cowabunga", 5)] returns 9, which is the location of the first a that occurs if you start counting from the 5th character.
    That is, search("a","cowabunga", 5) starts searching cowabunga from the 5th character, which is b. The function finds an a in position 9 of cowabunga.

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Google apps
Main menu
2905664146935785295
true
Search Help Center
true
true
true
true
true
263
false
false