---
title: "instr function in Strata | Oplema"
description: "Find where a search string first appears in text, counting from 1. For example, instr('test test', 'es') returns 2. Also called position or strpos."
url: "https://oplema.com/docs/strata/functions/instr"
updated: "2026-11-04"
---

# instr

Find where a search string first appears in text, counting from 1. Returns 0 if there is no match.

Also available as position, strpos.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **BIGINT**.

### Expression

```
instr('test test', 'es')
```

### Result

```
2
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | 2 |

## Arguments and types

```
instr(string, search_string)
```

**string**

Text

**search\_string**

Text

Supported signatures (1)

```
instr(string: VARCHAR, search_string: VARCHAR) → BIGINT
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[position

Find where a search string first appears in text, counting from 1. Returns 0 if there is no match.

](https://oplema.com/docs/strata/functions/position)[contains

Check whether text contains a search string. It also checks a list for an item, a map for a key and an unnamed struct for a value.

](https://oplema.com/docs/strata/functions/contains)[ascii

Return the Unicode number of the first character in text.

](https://oplema.com/docs/strata/functions/ascii)[ilike\_escape

Check whether text matches a LIKE pattern, ignoring uppercase and lowercase. The escape character lets the pattern search for a literal % or \_.

](https://oplema.com/docs/strata/functions/ilike-escape)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#instrstring-search_string)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
