---
schema_version: "1"
id: c62924a99da042f224992f4b6d922034be365a778bedd2ac517fb4217c2cf4a0
title: REGEXP_INSTR
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-matching/regexp-instr.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/regexp-instr.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3a86099b5609b190d7e9d653bd007d9efae8507fb2b852e3fdb2ae4c0bc9208e
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `REGEXP_INSTR`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the position of the first substring matching a regular expression pattern.

## Syntax

```sql
regexp_instr(<string>, <pattern>)
```

## Arguments

### Required

- `<string>`: The string to search within.
- `<pattern>`: The regular expression pattern to find.

## Returns

Returns an integer representing the one-based position of the match, or `0` if no match is found.

## Examples

### Find Pattern Position

Find the position of digits in a string.

```sql
SELECT regexp_instr('abc123def', '\d+') AS result;
```

Returns `4`, the position where digits begin.

### No Match

Returns `0` when pattern is not found.

```sql
SELECT regexp_instr('abcdef', '\d+') AS result;
```

Returns `0`.

### Find Word Position

Find the position of a word pattern.

```sql
SELECT regexp_instr('The quick brown fox', 'brown') AS result;
```

Returns `11`.

### Use in Filtering

Filter rows based on pattern position.

```sql
SELECT code FROM products
WHERE regexp_instr(code, '^[A-Z]{2}') = 1;
```

Returns products where code starts with two uppercase letters.

## Related Documentation

- [POSITION](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/string-func/position.md)
- [STRPOS](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/string-func/strpos.md)
- [REGEXP_SUBSTR](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/regexp-substr.md)
- [Regular Expression Syntax](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/string-matching.md#regular-expression-syntax)
