How to add regular expressions to datasets

In Shared Email Templates for Outlook

You can include regular expressions in a simple or an Excel-based dataset to find matching strings in the fields of received email messages and bring data from the corresponding dataset rows to your replies with the ~%DatasetValue or the ~%WhatToEnter macro. Here are the steps to follow:

  1. Start editing the simple dataset which you want to supplement with regular expressions. Add a new column and select Regex field from the dropdown menu.
    The Regex field option
  2. Add one more column to your dataset and select Regex.
    The Regex option
  3. In the Regex field column, select the field where you want to look for matching strings: body, from, to, cc, bcc, subject, location, recipient's or sender's first, last, or full name. In the Regex column, enter your regular expression.
    A sample dataset containing regular expressions

Now when your dataset is ready, you can use the data it contains in your outgoing email messages.

Suppose you often receive emails with some order IDs in the message body and those order IDs have an abbreviated country name as part of their structure, like this: "DE73491".
An abbreviated country name in an order ID

When replying to such an email, you'd like its message body to be checked for a specific abbreviation so that you can automatically include relevant information from your dataset in your reply. You'll need:

  • The Regex field column in your dataset with the body option selected
  • Regular expressions covering the structure of the order IDs in the Regex column, for example \bDE[0-9]{5}\b
  • The ~%DatasetValue macro in your template to bring the necessary details from the dataset to your reply, for example the name of the country and the delivery period
    A sample template with the ~%DatasetValue macro placeholders

When replying with such a template, you'll get the name of the necessary country and the delivery period automatically returned from your dataset and inserted into your email message:
Details returned from a sample dataset

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at support@ablebits.com.