---
title: REGEX_EXTRACT
url: https://www.tines.com/docs/formulas/functions/regex-extract/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# REGEX_EXTRACT

*[View on tines.com](https://www.tines.com/docs/formulas/functions/regex-extract/)*

Returns an array of all the regex matches on the input text.

Optionally, include a string containing [Ruby modifiers](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Modes) – e.g. `i` for case insensitive mode.

**Categories:** Text

## Syntax

```
REGEX_EXTRACT(text, regex, [modifiers])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": "The quick brown fox jumps over the lazy dog. It barked."
  }
}
```

Formula:

```
REGEX_EXTRACT(my_action.message, "[A-Z]")
```

Output:

```json
[
  "T",
  "I"
]
```

### Example 2

Input:

```json
{
  "example": "hello & HELLO"
}
```

Formula:

```
REGEX_EXTRACT(example, "hello", "i")
```

Output:

```json
[
  "hello",
  "HELLO"
]
```

### Example 3: Extracting multiple matching groups

Input:

```json
{
  "my_action": {
    "message": "see no evil, hear no evil, speak no evil"
  }
}
```

Formula:

```
REGEX_EXTRACT(my_action.message, "([a-z]+) no ([a-z]+)")
```

Output:

```json
[
  [
    "see",
    "evil"
  ],
  [
    "hear",
    "evil"
  ],
  [
    "speak",
    "evil"
  ]
]
```

### Example 4: A more complex example that extracts the first match and pipes it into another function.

Input:

```json
{
  "my_action": {
    "message": "This is an automatically generated message from Tines"
  }
}
```

Formula:

```
REGEX_EXTRACT(my_action.message, "(?<=This is)(.*)(?=generated)")[0][0] |> UPCASE(%)
```

Output:

```json
" AN AUTOMATICALLY "
```

## Sample actions

### Sample action 1

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "message": "The quick brown fox jumps over the lazy dog. It barked."
        }
      },
      "position": {
        "x": 2640,
        "y": 4155
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "REGEX_EXTRACT",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "regex_extract": "=REGEX_EXTRACT(my_action.message, \"[A-Z]\")"
        }
      },
      "position": {
        "x": 2640,
        "y": 4260
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```

### Sample action 2

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "description": "A more complex example that also extracts the first match and pipes it further to a down case function.",
          "message": "This is an automatically generated message from Tines"
        }
      },
      "position": {
        "x": 2850,
        "y": 4155
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "REGEX_EXTRACT",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "regex_extract": "=REGEX_EXTRACT(my_action.message, \"(?<=This is)(.*)(?=generated)\")[0][0] |> UPCASE(%)"
        }
      },
      "position": {
        "x": 2850,
        "y": 4260
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
