# Filter

## Description

This operation allows you to filter lines of text based on specific conditions or patterns. This operation is useful when you want to keep only lines that match a certain pattern or exclude lines that don't meet specific criteria.

***

## Data types

These are the input/output expected data types for this operation:

### Input data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FExtApHuiMxiHgaNWDLb2%2Fimage.png?alt=media\&token=5f4e1372-a2db-4d7e-b81b-976507cac896) - The input strings to be split and filtered.

### Output data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FyeZGvHDhYqskHKW5bdnp%2Fimage.png?alt=media\&token=d72665aa-3d46-4572-a463-a62344ee7f88) - The filtered results after applying the regular expression and delimiter.

***

## Parameters

These are the parameters you need to configure to use this operation (mandatory parameters are marked with a <mark style="color:red;">**\***</mark>):

<details>

<summary>Delimiter<mark style="color:red;"><strong>*</strong></mark></summary>

Choose the delimiter that separates each segment in your input data:

* **Space** - Your segments are separated by spaces.
* **Comma** - Your segments are separated by commas (`,`)
* **Semi-colon** - Your segments are separated by semi-colons (`;`)
* **Colon** - Your segments are separated by colons (`:`)

</details>

<details>

<summary>Regex<mark style="color:red;"><strong>*</strong></mark></summary>

Define the pattern for filtering using a regular expression, which enables more complex matching conditions.

</details>

<details>

<summary>Invert<mark style="color:red;"><strong>*</strong></mark></summary>

Set this parameter to **true** if you want to reverse the filter logic, so it keeps lines that **do not** **match** the specified pattern.

</details>

***

## Example

Suppose you want to **filter** a series of strings to extract only segments that start with `error`:

1. In your Pipeline, open the required [Action](https://docs.onum.com/the-workspace/pipelines/actions) configuration and select the input **Field**.
2. In the **Operation** field, choose **Filter**.
3. Set **Delimiter** to `Space`
4. Set **Regex** to `"^Error"`
5. Set **Invert** to `false`
6. Give your **Output field** a name and click **Save**. The strings in your input field will be filtered with the specified conditions.&#x20;

For example, this text:

```
"Error: File not found
Warning: Low memory
Info: Operation completed
Error: Disk full"
```

will be filtered as:

```
"Error:"
```

{% hint style="info" %}
You can try out operations with specific values using the **Input** field above the operation. You can enter the value in the example above and check the result in the **Output** field.
{% endhint %}
