Use fields functions to extract part of your data

Modified on Thu, 12 Oct 2023 at 11:53 AM

When utilizing data fields in various scenarios such as saving emails to folders or printing emails with fields, it is possible to extract only a portion of the data. This functionality proves useful when dealing with lengthy strings and you only require a specific section, such as an email or an order number.


Example: let's consider a scenario where you want to save an email to a folder using the email's unique ID as part of the folder or filename. However, the ID is quite long, like "%22456464xcvrg4vcv@sgdcv12%". In this case, you can extract only the last 4 digits by using the following function: RIGHT(%EMAIL_ID%, 4).


The following functions are available for your use:

- LEFT(field,X) = extract the X number of characters from the start (for example LEFT("Order received from King of Flowers", 5) return "Order")


- RIGHT(field,X) = extract the X number of characters from the end (for example RIGHT("Order received from King of Flowers", 7) return "Flowers")


- MID(field,X,Y) = extract the Y number of characters from the X position (for example MID("Order received from King of Flowers", 6, 8) return "received")


- REGEX() = use regular expressions to extract data, this function is particular and requires some computer skills. For more information on RegEx please check these sites:

https://blog.usejournal.com/regular-expressions-a-complete-beginners-tutorial-c7327b9fd8eb

https://regexone.com/


Here some basic examples to use REGEX in the fields:
- Extract all numbers in the email subject field:
REGEX(%EMAIL_SUBJECT%,[0-9]+)

- Exclude the characters #: in the attachment filename:
REGEX(%FILENAME_FULL%,[^#])

- Exclude some keywords: in the attachment filename:
REGEX(%FILENAME_FULL%,[^invoice|^factuur])

- Exclude the characters FW: in subject of email:
REGEX(%EMAIL_SUBJECT%,[^FW:])

- Extract words ending with .mp3 or .mp4 or .avi:
REGEX(%EMAIL_ATTACHMENT_LIST_FULL%,\w+\.(mp3|mp4|avi)\b)

- Extract text between a word and another:
REGEX(%EMAIL_BODY%,(?<=My words).[^last word]*)







Use right function to extract data



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article