Setting multiple variables from match elements text parser

Hi there,

I’ve been trying for hours and hours to set multiple variables from an email module.
I’ve tried aggregators, iterators, routers, ‘set multiple variables’, and multiple ‘set variable’ modules, filters, but nothing seems to work. It shouldn’t be this hard.

Basically, I have a module watching when new emails arrive. If it contains a specific title, it extracts the mail which contains a list that looks like this:
Name: John
Last name: Doe
E-mail: …
etc.

A HTML to text module converts it to text, after which another text parser (match elements) figures out that the delimiter is a “:”. It then puts out lots of bundles, meaning these are not separate variables. How do I make each key (and accompanying value) a separate variable, to be used in other following modules?

Thanks a lot in advance!

Welcome to the Make community!

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

(?<key>.+?): (?<value>.+)

Proof https://regex101.com/r/isCacG/1

Important Info

  • :warning: Global match must be set to YES!

For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Combining Bundles Using Aggregators

Every result (item/record) from trigger/iterator/list/search/match modules will output a bundle. This can result in multiple bundles, which then trigger multiple operations in future modules (one operation per bundle). To “combine” multiple bundles into a single variable, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and can apply to many use-cases like building of JSON, CSV, HTML.

You can find out more about the other types of aggregator modules here:

Example

Here is an example of how your scenario could look:
Screenshot_2025-03-15_110356

This is just an example. Your final solution may or may not look like this depending on your requirements.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Hi @samliew, thanks a lot for your response. The ‘match elements’ module I had puts out the same result as the match pattern you suggested. However, your second response with the array aggregator has helped.

For others: all I had to do was take the array: value in the ‘set multiple variables’ module, and putting the number of the array (see arrays output) between the brackets. Like this:

In that case you only need to set one variable.

To do this, you can use the built-in function toCollection

toCollection(array; key; value)

e.g.: (paste this into the field)

{{ toCollection(2.array; "key"; "value") }}

For more information, the function’s documentation can be found in the Help Centre. You should also complete the tutorials in the Make Academy.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.