> For the complete documentation index, see [llms.txt](https://formulapro.shadebridge.com/formula-pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://formulapro.shadebridge.com/formula-pro/formula-pro-custom-functions/text.md).

# Text Functions

Formula Pro custom text functions including regex support and string checks.

***

## CONTAINS

Checks whether a string contains another string. Case-sensitive by default.

**Syntax:** `CONTAINS(target, searchString, [caseSensitive])`

| Parameter     | Description                           |
| ------------- | ------------------------------------- |
| target        | The string to search in               |
| searchString  | The substring to find                 |
| caseSensitive | Optional. `true` (default) or `false` |

**Example:**

```
CONTAINS("Formula Pro", "Pro")
```

**Result:** `true`

**Example:**

```
CONTAINS("Formula Pro", "pro", false)
```

**Result:** `true` (case-insensitive)

**Example:**

```
CONTAINS("Formula Pro", "Excel")
```

**Result:** `false`

***

## TEXT

Formats a number as text using Excel-style format codes. Wraps Formula.js TEXT.

**Syntax:** `TEXT(value, format_text)`

**Example:**

```
TEXT(1234.56, "0.00")
```

**Result:** `"1234.56"`

**Example:**

```
TEXT(DATEVALUE("2025-03-09"), "YYYY-MM-DD")
```

**Result:** `"2025-03-09"`

***

## REGEXREPLACE

Replaces text matching a regex pattern. Supports replacement of all matches or a specific occurrence.

**Syntax:** `REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])`

| Parameter         | Description                                                                   |
| ----------------- | ----------------------------------------------------------------------------- |
| text              | Input text                                                                    |
| pattern           | Regex pattern (as string)                                                     |
| replacement       | Replacement string (supports `$1`, `$2` for capture groups)                   |
| occurrence        | Optional. `0` = replace all (default); `1`, `2`, ... = replace Nth match only |
| case\_sensitivity | Optional. `0` = case sensitive (default); `1` = case insensitive              |

**Example: Replace all occurrences**

```
REGEXREPLACE("tuttle", "t", "b")
```

**Result:** `"bubble"`

**Example: Replace specific occurrence**

```
REGEXREPLACE("tuttle", "t", "b", 2)
```

**Result:** `"tubtle"` (only second "t" replaced)

**Example: Capture groups**

```
REGEXREPLACE("2026-03-13", "(\d{4})-(\d{2})-(\d{2})", "$2/$3/$1")
```

**Result:** `"03/13/2026"`

**Example: Case-insensitive**

```
REGEXREPLACE("Product Vision", "vision", "plan", , 1)
```

**Result:** `"Product plan"`

***

## REGEXTEST

Tests whether text matches a regex pattern. Returns `true` or `false`.

**Syntax:** `REGEXTEST(text, pattern, [case_sensitivity])`

| Parameter         | Description                                            |
| ----------------- | ------------------------------------------------------ |
| text              | Text to test                                           |
| pattern           | Regex pattern                                          |
| case\_sensitivity | Optional. `0` = case sensitive; `1` = case insensitive |

**Example:**

```
REGEXTEST("hello@example.com", "@")
```

**Result:** `true`

**Example:**

```
REGEXTEST("Product-123", "^\d+$")
```

**Result:** `false` (string is not all digits)
