Using INSTR in BigQuery

If you ever need to do something different based on the existence of a particular substring in hashtag#BigQuery, take a look at the INSTR function.

It returns the 1-based index of the first occurrence of a substring (1 or more characters) in another STRING. The function returns 0 if the substring was not found.

There's also a possibility to specify at what position to start the search (like in good old Excel) and which occurrence to get.

Found it useful? Subscribe to my Analytics newsletter at