# 📗 Field Mask

Source: https://help.parsio.io/data-extraction/field-mask-1

This article applies only to Parsio’s template-based parser.



When you create a field, Parsio remembers the **context around it** in order to parse similar emails or documents. By default, Parsio uses only this surrounding context and matches **any value** found between it.

In some cases, however, you may want to add an extra **restriction on the field value itself**. This is where **field masks** come in.

![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2FbMAFuB7jTcQ1636993950564-1636993950564.png)

## Use case

Here’s a real-world example.

A freelancer sells two types of digital products on a marketplace:

- WordPress themes
- WordPress plugins

![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2FabzSv2qbRcQ1636993624369-1636993624369.jpeg)![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2FabzSv2qbRcQ1636993662298-1636993662298.jpeg)

The marketplace forwards all transaction emails to Parsio. These emails are almost identical, so a single template would normally match both types. However, the freelancer wants:

- A separate template for each product type
- A transaction type included in the exported data

## Using an exact match mask

The easiest solution is to create a field called **type** and apply an **Exact match** mask.

Parsio will then:

- Look for a specific keyword in the email (for example, `plugin` or `theme`)
- Apply the template **only if** the field contains the exact specified value

![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2F0jlXJ0s8iUY1638276421192-ghdmupnpomeactwk6mx5_eg_4ws-bMAFuB7jTcQ1636994424548-1636994424548.jpeg)![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2F0jlXJ0s8iUY1638276439938-ghdmupnpomeactwk6mx5_eg_4ws-bMAFuB7jTcQ1636994470362-1636994470362.jpeg)

This ensures that the correct template is applied to each email type.

Note: Fields with a non-default mask are marked with an orange dot on the field’s settings icon.



## Available masks

Field masks are **template-specific**, meaning the same field can use different masks in different templates.

Parsio provides several built-in masks and also allows you to define custom masks using regular expressions.

| **Mask** | **Description** |
|---|---|
| None | Match any HTML or text value |
| Plain text | Match text values only (no HTML tags) |
| Single word | Match letters, numbers, and underscores (no spaces) |
| Alphanumeric string | Match letters and numbers only |
| Email | Match a valid email address |
| Decimal | Match positive or negative decimals (for example, -12, 42, 0) |
| Exact match | Match the exact value |
| Custom regex | Define your own mask using a regular expression |

## Regular expressions

Regular expressions (regex) are patterns used to match specific text formats.

### Example

Suppose you want to parse the following string: `Timestamp: Monday, 15 November 2021 18:14:35`

You want to extract:

- **Date** → `15 November 2021`
- **Time** → `18:14:35`

If you create two fields without additional constraints, Parsio may extract incorrect values due to insufficient context.

![](https://s3.amazonaws.com/helpsite-uploads/ghdmupnpomeactwk6mx5_eg_4ws%2FfXWalnExiw01636996843238-1636996843238.jpeg)

To fix this, you can apply a **custom regex** to the *date* field: `[a-zA-Z0-9 ]*`

#### How it works

- Square brackets `[]` define a **character class**, allowing:
    
    
    - Letters
    - Numbers
    - Spaces
- The asterisk `*` is a **quantifier** that matches the preceding character class zero or more times

This helps Parsio correctly identify the intended value.

## Learn more about regex

Regular expressions are a powerful but complex topic. For further reading, check out:

- [Quick-Start: Regex Cheat Sheet](https://www.rexegg.com/regex-quickstart.php)
- [Regex101](https://regex101.com): Build, test, and debug regex
