---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/regexp-substr.md
cuppy_section: docs
cuppy_doc: W883-CG3H
cuppy_doc_uuid: 13869afc-8f79-4c7d-9c56-84b1f7445403
cuppy_permalink: https://cuppy.io/salesforce/d/W883-CG3H
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/regexp-substr
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: bab438f6b44326c16c7fcc90d13a2616a6699b1c0be9ad73d8737bc819715967
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/regexp-substr.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## `REGEXP_SUBSTR`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the substring matching a regular expression pattern.

*   `<string>`: The string to search within.
*   `<pattern>`: The regular expression pattern to match.

Returns a text value containing the matched substring, or `NULL` if no match is found.

*   Returns the first match when multiple matches exist.
*   For detailed regex syntax, see [Regular Expression Syntax](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/string-matching.html#regular-expression-syntax).

Extract a sequence of digits from a string.

Returns `'123'`.

Returns NULL when pattern is not found.

Returns `NULL`.

Extract the domain from an email address.

Returns `'@example.com'`.

Extract a word pattern.

Returns `'$99.99'`, because the digit string is considered a word.

Provide a default when no match.

Returns the matched digits or ‘0’ if none are found.

*   [SUBSTRING](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/substring.html)
*   [REGEXP_INSTR](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/regexp-instr.html)
*   [REGEXP_REPLACE](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/regexp-replace.html)
*   [Regular Expression Syntax](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/string-matching.html#regular-expression-syntax)


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
