match
  • 17 Nov 2023
  • Dark
    Light
  • PDF

match

  • Dark
    Light
  • PDF

Article summary

Task Purpose

The match task is used to find Regex (regular expression) matches in a string and returns the matches as an array.

Properties

Input and output parameters are shown below.

Incoming Type Description
str String Required. The string to search.
regExp String Required. The regular expression to match.
flags String Indicates the flags to include. For a list of available flags, refer to the Regular Expressions guide on the MDN docs site.

Outgoing Type Description
matches Array Returns an array of the match results. If the regular expression does not include the g flag (to perform a Global Search), the task will return only the first match in the string. If no match is found, then 'null' is returned.

How to Configure

In this example the str Reference variable to search are the words Hello World.

The regExp expression to match is the character /o/, and the flags variable is set to g, which is a Global Search of the entire string.

Figure 1: Search String and RegExp
03-IAP23.1-match-input


Figure 2: Flags Variable
04-IAP23.1-match-input2


The result that returns from this task will show the matched characters in the expression that was searched. There are two letter "o" characters in the words Hello World and both will be displayed in the outgoing matches variable as ["o","o"].


Figure 3: Output - Operations Manager
05-IAP23.1-match-output


Use Cases

Suppose you have a dataset and you want to find and retrieve a certain character or number. You can use the match task to search, retrieve and display all matches that contain an occurrence of the Regex.

References

For related information, see the match API reference.


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.