1. Overview
  2. Data Extraction
  3. Optional (Empty) Fields

Optional (Empty) Fields

Sometimes you want to mark a few fields as "optional" or "empty" because they don't exist in some of your emails. By design, Parsio must find all the fields in your document to consider it as successfully parsed.

However, there are two main solutions to solve this.

Option 1. Create Multiple Templates

Most of the time, this is the best option.

With Parsio, you can create multiple templates for each inbox. Parsio automatically chooses the best template to apply. First, it tries to use the one with the most fields. If it fails, Parsio will choose the next one and so on.

Thus, you can create a template which has all the fields, and one or a few templates which don't include some of them.

Option 2. Use a Field Mask

You can also try a "trick" to mark some fields as optional.

By default, when you create a field, Parsio will use a regex .+? to find its value in a document:

This expression literally means "find text that is one or more characters long".

Now, you can choose the "Custom regex" option and type this expression: .*? which means "find text that is zero or more characters long":

This trick can be useful in many cases, but it highly depends on your document and we recommend to use the first option when it's possible.

Was this article helpful?
© 2024 Parsio Knowledge Base