> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# match

> Use the match task to find regex matches in a string and return results as an array.

The `match` task finds regex (regular expression) matches in a string and returns the matches as an array.

## Potential use case

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.

## Properties

| 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/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, `null` is returned. |

## Example

In this example, the `str` reference variable to search is 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.

![](/_fern-img/103d02a60b2c2dfc58269d29e7035f82e2d8c2f70a8da824327cc4cdf668ad80.webp)![](/_fern-img/ead6955818a299b54b3e4256f7f22fc96ef5d68ed35d59a54447931b24a7545c.webp)

The result returned from this task shows 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"]`.

![](/_fern-img/ad6196cff2bff2ad14a3b7a6703153e33bd008580851dc005017a3bd6f5e7f92.webp)

## Related reading

For related information, see the [match API reference](https://apidocs.itential.com/api/app-workflow_engine/match/).