# Extract

Extracts the specified regular expression patterns from a string to an array

```mathematica
Extract("code: 650-33", "[0-9]{3}", "^", "$") → "650"
Extract("text text", "[o-y]", "[e]", "[xt]") → "x"
Extract("123 056", "[2-5]", "[1]", "[6]") → 2
```

#### Inputs

`Extract(string, searchRegexp, startAfterRegexp, endBeforeRegexp, [index])`

* `string` - Any text value to extract from
* `searchRegexp` - Regular expression to find to
* `startAfterRegexp` - Regular expression to start the search after
* `endBeforeRegexp` - Regular expression to end the search before
* `[index]` - **\[optional**: `O` by default\*\*]\*\*


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tabula.io/data-transformation/formulas/string-functions/extract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
