Search HoldMyTwist

Browse all posts

Make Text parser: extract order IDs and catch no matches

This guide will show you how to use Make Text parser to get a 4-digit order ID. This will test to see what happens if there is no match, or there are 2 matching IDs. This is done before adding another app to connect.

A brass magnifying glass isolates a gold tag on an order slip beside a navy review tray.

The recorded scenario is a Text parser followed by Tools. Text parser is where you paste the notification text. Tools is where you see the output. There's no inbox and no spreadsheet written. The test with no match and the continuation set to No didn't run Tools, but the scenario ran. The test with continuation set to Yes had Tools run and ifempty returned REVIEW INPUT. Instructions cover both scenarios. Then the message with two order IDs is tested. Results are in the table below for those runs.

Change in this exercise

Observed Tools result

Original ORD-1042 notification; Global match No

ORD-1042

ORD-10421; no-match continuation No

Tools did not execute

ORD-10421; no-match continuation Yes

REVIEW INPUT

Order reference: ORD-1042; continuation Yes

REVIEW INPUT

ORD-1042 and ORD-2057; Global match No

ORD-1042 only

ORD-1042 and ORD-2057; Global match Yes

Two operations: ORD-1042 and ORD-2057

Rerun the unchanged two-ID message; Global match Yes

The same two IDs again

The 4-digit order number is a made up format for this exercise. Different ID formats need different patterns and representative message tests. Finding the corresponding string does not ensure the notification is valid or that the order actually exists.

Before you start

It's ok to use the Free plan (opens in a new tab) with credits available. For this task you can just use Run once and disable the scheduling. No other apps will be connected, no AI module will be used, nor a free trial of a paid version.

You can sign up for an account with Sign up for Make Free (opens in a new tab). It's an affiliate link. We can make a commission if you purchase through it (no extra fee to you).

Use the field if your app already has an order-ID field. A pattern can be useful if the notification consistently uses a label and has a consistent ID format. Maybe it will be even easier to copy manually if you have a few references.

1. Extract one order ID

  1. Open Scenarios > Create a new scenario. Name it Order reference practice.
  2. Add Text parser > Match pattern. Choose regular Match pattern.
  3. In Pattern enter (without slashes):
Text to copy

Order ID:[ \t]*(?<orderId>ORD-[0-9]{4})\b

  • Order ID: matches that exact label
  • [ \t]* : after the label, there can be spaces or tabs
  • (?<orderId>ORD-[0-9]{4}) captures the ORD- and the following 4 digits as orderId
  • \b at the end makes sure it won't just capture first 4 digits of ORD-10421. See Text parser help (opens in a new tab) for capture groups and Global match.
  1. Change Global match to No, Case sensitive to Yes, Multiline to No, Singleline to No.
  2. Continue the execution of the route even if the module finds no matches should be No, for the first test.
  3. Add this fake notification in Text:

Make Text parser pattern with named orderId group, Global match No and Case sensitive Yes.

Make Text parser pattern with named orderId group, Global match No and Case sensitive Yes.
Open full-size image
Text to copy

Order confirmation
Order ID: ORD-1042
Items: 2
Tracking: TRK-7788

Make Text parser input with fictional order ORD-1042 and no-match continuation set to No.

Make Text parser input with fictional order ORD-1042 and no-match continuation set to No.
Open full-size image
  1. Save the Text parser module as well as the scenario (without scheduling).
  2. Choose Run once. So far it's just a test in isolation. Continue past the warning that there is unused output for the last module. Open the execution bubble for Text parser and select Operation 1.

You'll notice that orderId: ORD-1042 is returned. Tracking number and item count are missing from the output.

It's taking the ORD-1042 and ignoring the rest of the numbers.

Make Text parser output contains orderId ORD-1042 from the fictional order text.

Make Text parser output contains orderId ORD-1042 from the fictional order text.

It's taking the ORD-1042 and ignoring the rest of the numbers.

Open full-size image

2. Add a visible result

  1. Close the execution panel and click the plus control after Text parser. Add Tools > Set variable.
  2. Set Variable name to result.
  3. In Variable value you'll need to place the following expression. Note that the mapped orderId token points to module 1 in Text parser. If your text parser isn't module 1, then pick orderId from whichever module the parser is.
Text to copy

{{ifempty(1.orderId; "REVIEW INPUT")}}

The first argument to ifempty is the mapped orderId token from Text parser.

The second argument to ifempty is the hardcoded text REVIEW INPUT.

If first argument is not empty, output it.

If first argument is empty, output REVIEW INPUT.

Check here Make general functions reference (opens in a new tab) for both.

Make Tools Set variable maps orderId through ifempty into a result field.

Make Tools Set variable maps orderId through ifempty into a result field.
Open full-size image
  1. Save your module + scenario. Then choose Run once.
  2. Launch the execution bubble for Tools. You should see result: ORD-1042 in the output.

Watch out

ifempty only returns the fallback when Tools is run. If you don't have no-match continuation, a non-matching message won't go through to Tools.

Turn on continuation and you can get REVIEW INPUT for that message. See what comes out. Did it pull out an ID? Just because you got to the end of the scenario doesn't mean it did.

3. Catch a message that does not match

  1. In the next input test, we do not have 4 digits. We have 5 digits. Launch Text parser. Replace the Text field with the following imaginary notification. ORD-10421 is the reference in the notification.
Text to copy

Order confirmation
Order ID: ORD-10421
Items: 2

  1. For the first no-match test, set the setting called Continue the execution of the route even if the module finds no matches to No. Save the module and the scenario. Choose Run once.
  2. Observe the run. In the captured run, nothing was extracted by Text parser and there was no execution bubble in Tools. The run ended with no order ID.
Here's the screenshot (the no-match test with continuation off). Tools was not executed for this input.

The parser runs without a match and the downstream Tools module has no operation.

The parser runs without a match and the downstream Tools module has no operation.

Here's the screenshot (the no-match test with continuation off). Tools was not executed for this input.

Open full-size image
  1. Set no-match continuation -> Yes. Do not change 5 digit input. Save module & scenario. Click Run once.
The screenshot shows that your no-match continuation is set to Yes. But your 5 digit notification is still the same.

Make Text parser continuation set to Yes with the deliberately wrong five-digit order ID.

Make Text parser continuation set to Yes with the deliberately wrong five-digit order ID.

The screenshot shows that your no-match continuation is set to Yes. But your 5 digit notification is still the same.

Open full-size image
  1. Check the Tools bubble again, look for result: REVIEW INPUT.
  2. Keep ORD-10421 and continuation Yes. Again press Run once. It was REVIEW INPUT again for the second run.
  3. Revert to the notification with 4 lines (see section 1). Save and run again. We got ORD-1042 in the check in Tools.
In the screenshot it's: Tools output: result: REVIEW INPUT. It wasn't 4 digits in the notification.

Make Tools output contains REVIEW INPUT after the parser finds no match.

Make Tools output contains REVIEW INPUT after the parser finds no match.

In the screenshot it's: Tools output: result: REVIEW INPUT. It wasn't 4 digits in the notification.

Open full-size image

Changing the label to Order reference: ORD-1042 also gave us REVIEW INPUT in our exercise. REVIEW INPUT is just plain output text, not the creation of a review queue or stopping a subsequent module from outputting that text to a record. So how are you going to react to this result? Before hooking up a destination you need to think.

4. Check whether one message has several IDs

  1. For the multi-match test you need to have two lines. Both need to start with Order ID:. You need to have these two lines in the Text box. (ORD-1042) (ORD-2057)
Text to copy

Order ID: ORD-1042
Order ID: ORD-2057

  1. Set Global match as No. Save and run. Only ORD-1042 was in our Tools output.
  2. Set Global match as Yes. Save and run. Go to the Tools execution bubble and open both operations (expand them).

For every match of Text parser, you have a bundle of data for the route. In our two matches there were two Tools operations: 1st - ORD-1042; 2nd - ORD-2057.

Global match is turned on. And ORD-2057 is in the second Tools operation.

Make Tools Operation 2 outputs ORD-2057 when Global match is Yes.

Make Tools Operation 2 outputs ORD-2057 when Global match is Yes.

Global match is turned on. And ORD-2057 is in the second Tools operation.

Open full-size image

We ran the same message (for 2 IDs) again. We got the same 2 IDs again. There is no history in these 2 modules on what orders have already been processed. You'll need to think of how to deal with duplicates before you add the create/update step in. How to deal with duplicate notifications and quoted old messages? (please see our guide to using Data Store to check duplicates on how to store the IDs separately)

If you want to go back to single order practice: revert to the original 4 line notification and make sure Global match is No. Also don't schedule anything.

If you need all matches in one output

The recorded exercise uses Text parser and Tools. Set variable doesn't merge incoming bundles. So if you want a single combined output for your next action, then the choices documented below are different extensions to experiment with using 2 ID input, Global match Yes, schedule off.

  • For a records list, use Array aggregator. Set Source Module to Text parser and include orderId in Aggregated fields. See the guide for details on source and output verification.
  • For a single readable text value, use Text aggregator. Its text template and row separator manage the summary.

You'd use toCollection (opens in a new tab) to convert an array of key-value objects to a collection if you have named fields. That requires a different capturing pattern than orderID from this example.

Test for repeated labels before conversion. Use an array if each repeated value is important.

Repeat the no-match message test after adding an aggregator. Empty aggregation may yield result (may trigger next module by default). You could use Stop processing after an empty aggregation (for Array aggregator) before destinations if using array aggregator.

When the pattern needs changing

  • Tools not running at all? Look at the label. Order ID: Check uppercase ORD-, 4 digits and no-match continuation. Case sensitive is Yes. If the label, case or ID format is different, you need to change the pattern and test for representative notifications.
  • Parser produces empty bundle after edit of pattern? Check the capture group. Here it is (?<orderId>ORD-[0-9]{4}). A pattern with no capture groups produces empty output bundle. See Make's Text parser (opens in a new tab) for more info.
  • Mapper has no orderId? Use a working sample to run the parser and see what comes out of it.
  • Tools just gives plain text of your expression? Check the token you map. Check the curly braces of the expression.

HTML, replies with quotes, punctuation etc may require some other approach. No inbox is linked here and no order is created/updated in this exercise using plain text...

Do the above checks on Make Free (opens in a new tab) (the funny inputs). No scheduling yet. Be prepared for duplicates. And test where you send your stuff...

Sources: Make Text parser (opens in a new tab), Make general functions (opens in a new tab) and Make pricing (opens in a new tab).

Share this post