Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fstring%2Fcontains.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fstring%2Fcontains.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `contains`

## Description

Returns `true` if the given substring appears anywhere in a string; otherwise return `false`. The check is case sensitive. For case-insensitive matching, normalize both values with `toLowerCase()` or `toUpperCase()` before calling `contains`.

## Syntax

Like many functions in DataPrime, `contains` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
contains(value: string, substring: string): bool
```

```
(value: string).contains(substring: string): bool
```

## Arguments

| Name        | Type     | Required | Description                                               |
| ----------- | -------- | -------- | --------------------------------------------------------- |
| `value`     | `string` | **true** | The full string to search (haystack)                      |
| `substring` | `string` | **true** | The substring to look for within the full string (needle) |

## Example 1

**Check if an AWS Account ID appears in an ARN**

Sometimes only a broader field such as an ARN is available. Use `contains` to test for the presence of the account ID.

### Example query

* Function notation
* Method notation

```
create is_from_account from contains(arn_field, '074157727657')
```

```
create is_from_account from arn_field.contains('074157727657')
```

### Example output

Both notations produce a field `is_from_account` that is `true` if the ARN contains the account ID.

## Example 2

**Use case 2: Check if a domain appears within a URL**

Use `contains` to verify if a domain name exists inside a given URL.

### Example query

* Function notation
* Method notation

```
create is_from_google from contains(url, 'google.com')
```

```
create is_from_google from url.contains('google.com')
```

### Example output

Both notations produce a field `is_from_google` that is `true` if the URL contains `google.com`.
