Sign in
    Shared Email Templates

    Insert text using a regular expression

    The RegexMatch macro in Shared Email Templates automatically scans an Outlook email for a regular expression (regex) match and, depending on whether a match is found or not, inserts one of the two specified pieces of text. To add the macro to your template, follow the steps below.

    1. Start creating or editing a template.

    2. Place the cursor where you want to insert the predefined text.

    3. On the template editor toolbar, select the The Insert macro button Insert macro button.

    4. Select RegexMatch.

    5. In the Regex match dialog:

      • Select the fields you want to search for a regex match (message body, From, To, Cc, Bcc, Subject, recipient’s first, last, or full name, sender’s first, last, or full name).
      • Enter a regex.
      • If you want to make the search case insensitive, select the corresponding checkbox.
      • Enter the value if matched (the text that will appear in your email message if a regex match is found).
      • Enter the value if not matched (the text that will appear in your email message if a regex match is not found).

      When you’re ready, select OK.

      The Regex match dialog
    6. Save the template.

    When you insert the template into an Outlook email message, the fields you selected are searched for a regular expression match. If a match is found, the first piece of text is inserted; if not, the second one is used instead.

    A sample template that contains the RegexMatch macro is inserted into an Outlook email