# Extract Elements from Text

## Overview

This collection of operations is used to extract specific elements from a text, including lines, words, characters, URLs, numbers, and patterns.

### 1. Extract Words

This operation extracts individual **words** from a text. A word is a contiguous collection of characters delimited by a space.

#### Syntax

```
the text is "{input}"
get the text's words
```

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

**Parameters** are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

| Parameter | Description     | Example                       | Required |
| --------- | --------------- | ----------------------------- | -------- |
| `input`   | The input text. | She quickly ran to the store. | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the sentence is "She quickly ran to the store."
get the sentence's words
```

{% endtab %}

{% tab title="Results" %}

```
She
quickly
ran
to
the
store.
```

{% endtab %}
{% endtabs %}

***

### 2. Extract Lines

This operation extracts individual **lines** from a text. A line refers to a single row of text that is typically separated by a line break or new line character.

#### Syntax

```
the text is "{input}"
get the text's lines
```

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

**Parameters** are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

| Parameter | Description     | Example                                                                                                                | Required |
| --------- | --------------- | ---------------------------------------------------------------------------------------------------------------------- | -------- |
| `input`   | The input text. | The quick brown fox jumps over the lazy dog. It loves to run fast. The dog watches quietly. Both enjoy the open field. | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the paragraph is "The quick brown fox jumps over the lazy dog. \n It loves to run fast. \n The dog watches quietly. \n Both enjoy the open field."
get the paragraph's lines
```

{% endtab %}

{% tab title="Results" %}

```
The quick brown fox jumps over the lazy dog.
It loves to run fast.
The dog watches quietly.
Both enjoy the open field.
```

{% endtab %}
{% endtabs %}

***

### 3. Extract Characters

This operation extracts individual **characters** from a text.

#### Syntax

```
the text is "{input}"
get the text's characters
```

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

**Parameters** are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

| Parameter | Description     | Example | Required |
| --------- | --------------- | ------- | -------- |
| `input`   | The input text. | Be kind | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the saying is "Be kind"
get the saying's characters
```

{% endtab %}

{% tab title="Results" %}

```
B
e
 
k
i
n
d
```

{% endtab %}
{% endtabs %}

***

### 4. Extract URLs

This operation extracts **URLs** from a text.

#### Syntax

```
the text is "{input}"
get the text's URLs
```

> **Note:** The terms `url(s)` or `URL(s)` can be used in any case and in either singular or plural form.

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

**Parameters** are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

| Parameter | Description     | Example                                        | Required |
| --------- | --------------- | ---------------------------------------------- | -------- |
| `input`   | The input text. | Visit our website at <https://www.example.com> | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the subheader is "Visit our website at https://www.example.com"
get the subheader's url
```

{% endtab %}

{% tab title="Results" %}

```
https://www.example.com
```

{% endtab %}
{% endtabs %}

#### Notes

> **Implementation Detail:** This is the regular expression used internally to find URLs in a given text:\
> `((http|https)://)?\[a-zA-Z0-9./?:@-_\=#]+.(\[a-zA-Z]){2,6}(\[a-zA-Z0-9.&/?:@-_\=#])\*`

***

### 5. Extract Numbers

This operation extracts **numbers** from a text.

#### Syntax

```
the text is "{input}"
get the text's numbers
```

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

**Parameters** are placeholders for data. Refer to the table below for details on each parameter in this operation. In the syntax, replace parameters with your own values.

| Parameter | Description     | Example                                            | Required |
| --------- | --------------- | -------------------------------------------------- | -------- |
| `input`   | The input text. | There are 150 apples and 35 oranges in the basket. | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the sentence is "There are 150 apples and 35 oranges in the basket."
get the sentence's numbers
```

{% endtab %}

{% tab title="Results" %}

```
150
35
```

{% endtab %}
{% endtabs %}

***

### 6. Extract Substring

This operation extracts **substrings** from a text.

#### Syntax

```
the text is "{input}"
get the text's substrings which match "{pattern}"
```

#### Data

The table below lists the names of the data elements in this operation and indicates which can be renamed in the syntax.

| Data Name | Can Be Renamed |
| --------- | -------------- |
| the text  | Yes            |

#### Parameters

| Parameter | Description                    | Examples                                                           | Required |
| --------- | ------------------------------ | ------------------------------------------------------------------ | -------- |
| `input`   | The input text.                | The order number is ORD123456 and should be processed by tomorrow. | Yes      |
| `pattern` | A regular expression to match. | ORD\[0-9]+                                                         | Yes      |

#### Example

{% tabs %}
{% tab title="Automation" %}

```
the text is "The order number is ORD123456 and should be processed by tomorrow."
get the text's substrings which match "ORD[0-9]+"
```

{% endtab %}

{% tab title="Results" %}

```
ORD123456
```

{% endtab %}
{% endtabs %}
