Regular Expression Match

Searches an input string for all occurrences of a regular expression and returns all the matches with the help of Make.

Note

If you have an active Plumsail Documents subscription, this action is free, i.e., it doesn’t consume documents limit of the subscription. Please also check the licensing details.

We would recommend you to use Regex 101 tool to test your expressions. It supports the same syntax as actions. By default, Regex101 works with the PCRE2 syntax. You should change it to .NET (C#) in the “Flavor” section under “Save & Share”.

Parameters

Output Parameters

Parameter

Description

Example

Bundle

The dynamic response based on a pattern that is used in this action. Contains all matches groups that included in the pattern (named or unnamed).

Match0, TaskId, status

../../_images/make-regexp-match-output.webp

Input Parameters

Parameter

Description

Example

Connection

To allow your scenarios to get information from and send it to Plumsail Documents, you need to create a connection.

For more information on how to create a connection to Plumsail Documents, see the online Help.

Regular Expression Pattern

This pattern can contain inline options to modify behavior of the regular expression. Such options have to be placed in the beginning of the expression inside brackets with question mark: (?YOUR_OPTIONS). For example options (?mi) will allow to process multi line text with case insensitivity. You can find additional information about inline options in the MSDN article. Also you can find an example in this article.

Task (?<TaskId>\d+):(?<status>Approve|Reject)

String to search for matches

You can either enter static text or select dynamic values from other apps in the scenario.

Task 5:Approve\nTask 53:Reject\nTask 52:Approve

Examples

Advanced

Let’s suppose you are getting a new email after someone made a purchase and you need to extract information from this email and create a new record in your Airtable database.

Your email might look like this:

*** Order information ***
Time zone: GMT+00:00
Reference: 4563452
Order number: 1400
Payment method: Visa/MasterCard
Order status: Credit card payment authorized

*** Ordered products ***
Product code: D3F13B23B0
Title: Tires
Price: 150
Quantity: 4

Product code: FD3423DE
Title: Cookies
Price: 30
Quantity: 20

Product code: KFG45GK445
Title: Tools
Price: 50
Quantity: 10

*** Delivery information ***
First name: John
Last name: Doe
Company: Happy Company Ltd
Country: Australia
Phone: 01 2345 6780

And this is the scenario:

Regular Expression Match Example

Let’s check the settings.

The scenario starts with the Watch emails trigger. It monitors incoming emails as per the settings:

Regular Expression Match Example

Next, the incoming email content is processed by the Plumsail action Regular expression match:

Regular Expression Match Example

We use the Regular Expression Pattern to find titles, prices, and quantity:

Title: (?<Title>.+|)
Price: (?<Price>.+|)
Quantity: (?<Quantity>\d+)

And we select the text content output from the Watch emails trigger to scan the email body text.

Regular Expression Match Example

As a result of the action we receive separate output values for each named regular expression group: Price, Quantity, Title.

You can learn more about named groups on this page.

The action is smart enough to create separate output value for each named regular expression group that is used in it.

It dramatically simplifies extraction of values from text strings. You just write a regular expression with named groups and then use them across your scenario.

You can easily put match regex into a named group like this: (?<Title>.+|). The name of this group will be “Title”, everything that matches regular expression .+| will be returned as a separate output of the action.

In the last step, we are using the values from the Regular expression match step to create records in Airtable.

Regular Expression Match Example