> For the complete documentation index, see [llms.txt](https://docs.couchdrop.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.couchdrop.io/automations/actions/extract-variables.md).

# Extract Variables

Learn about the Extract Variables Action category in Automations.

Extract Variables Actions allow you to extract a variable from a file or filename that can be used for actions later in the workflow.

## How to use Extract Variables Actions

Extract Variables actions have specific circumstances and conditions required in order to be used. Before a variable can be used in actions, it must first be extracted and defined. Once the variable is successfully defined, it will appear in the [custom variables](/automations/variables.md#custom-variables) list in later actions.&#x20;

{% hint style="warning" %}
We recommend performing Extract Variables Actions as early as possible to ensure they will be available where needed.&#x20;
{% endhint %}

### Required fields

Extract Variables Actions require the same fields and have an option to test them directly during creation.

<table><thead><tr><th width="214.9453125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>A name for the variable. This must be unique. </td></tr><tr><td>Regex pattern</td><td>Define a regex pattern for extracting a variable.</td></tr><tr><td>Description (Optional)</td><td>Describe the variable and what it does. This field is for internal use only.</td></tr><tr><td>Test your Regex (Optional)</td><td>Enter an example filename to test match your regex against, and see what would be extracted.</td></tr></tbody></table>

## Available Extract Variables Actions

<table><thead><tr><th width="216">Action Category</th><th>Description</th></tr></thead><tbody><tr><td>Extract Variable from Filename</td><td>Extract a custom variable using a regex pattern for later use</td></tr><tr><td>Extract Variable from File</td><td>Extract an Automation Variable from a file to be used in other actions</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.couchdrop.io/automations/actions/extract-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
