# strpos

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: strpos
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/string-functions/strpos
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/string-functions/strpos.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/string-functions/strpos.adoc
description: Use the `strpos()` function to return the position from where the substring (the second argument) is matched with the string (the first argument).
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/string-functions/strpos.md -->

Use the `strpos()` function to return the position from where the substring (the second argument) is matched with the string (the first argument).

```sql
STRPOS(string, substring)
```

The input and return must be of type `string`.

**Special cases:**

-   Returns `NULL` if there are no input rows or `NULL` values.

-   If the `SUBSTRING` is not found in the string, then the `strpos()` function will return 0.


## [](#examples)Examples

### [](#basic-strpos-function)Basic `strpos()` function

This example shows how to find the **ut** (substring) position in the **computer** (string):

```sql
SELECT STRPOS('computer', 'ut') AS "Position of ut";
```

The result shows that **ut** is located at the fifth character of **computer**:

```sql
+-----------------+
| Position of ut  |
+-----------------+
| 5               |
+-----------------+
```

### [](#strpos-function-using-column)`strpos()` function using column

The **listofwords** table stores word data:

```sql
CREATE TABLE listofwords (
  words text
);
INSERT INTO listofwords
    (words)
VALUES
    ('corral'),
    ('traditionally'),
    ('real'),
    ('communal'),
    ('challenge'),
    ('fall'),
    ('wall'),
    ('gallop'),
    ('albatross');
```

```sql
SELECT * FROM listofwords;
```

The preceding query shows the table:

```sql
+----------------+
| words          |
+----------------+
| corral         |
| traditionally  |
| real           |
| communal       |
| challenge      |
| fall           |
| wall           |
| gallop         |
| albatross      |
+----------------+
```

The query returns the words and a position of a specific substring = '**al**' using the `strpos()` function:

```sql
SELECT words, STRPOS(words, 'al') AS "Position of al"
FROM listofwords;
```

The result displays the **al** position of different words:

```sql
+----------------+------------------+
| words          | Position of al   |
+----------------+------------------+
| corral         | 5                |
| traditionally  | 10               |
| real           | 3                |
| communal       | 7                |
| challenge      | 3                |
| fall           | 2                |
| wall           | 2                |
| gallop         | 2                |
| albatross      | 1                |
+----------------+------------------+
```