> For the complete documentation index, see [llms.txt](https://docs.cloudfabrix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudfabrix.io/rda/rda-userguide/rda-aiops-studio/examples-jupyter/data-mapping-cfxdm-dm-functions/match.md).

# Match

**Match**

Matches a regular expression and extracts a specific value (if matched). \
@param expression type string. Regular expression \
@param flags List of optional flags (A I M L S X) Input must be a string.\
\
I - IGNORE THE CASE\
A - ASCII\
L - LOCALE\
X - VERBOSE\
M - MULTILINE MATCH\
S  -  '.' matches all (otherwise regex has a limited set of chars where it matches with )<br>

This function allows users to search for a match using regular expressions within a given dataset.<br>

### Example 1:&#x20;

Step 1: Create an empty **match\_example\_1** using AIOps studio as shown in the below screenshot. 

![Empty pipeline](/files/-MeIZ2v_tGnAM_Nmlj8v)

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a list of rows with hostname and ipaddress`*\
*`##### RDA dm function 'match' used to demo this example. In this pipeline, each row added`*\
*`##### has a column with IPAddress and hostname.`*\
\
*`##### Pipeline uses RDA dm function match to match to regular expression to pick only`* \
*`##### ipaddresses.`*\
\
*`@dm:empty`* \
*`--> @dm:addrow id = 'a1' & APP_Client_FQDN = "host1.acme.com"`*\
*`--> @dm:addrow id = 'a2' & APP_Client_FQDN = "host2.acme.com"`*\
*`--> @dm:addrow id = 'a3' & APP_Client_FQDN = "host3.acme.com"`*\
*`--> @dm:addrow id = 'a4' & APP_Client_FQDN = "172.17.0.1"`*\
*`--> @dm:addrow id = 'a5' & APP_Client_FQDN = "192.168.60.120"`*\
*`--> @dm:addrow id = 'a6' & APP_Client_FQDN = "172.17.0.4"`*\
*`--> @dm:addrow id = 'a7' & APP_Client_FQDN = "172.17.0.3"`*\
*`--> @dm:map func = 'match' & from = 'APP_Client_FQDN' & to = 'IPaddress' & expr = "^(?:[0-9]{1,3}.){3}[0-9]{1,3}$"`*<br>

![Pipeline code added to empty pipeline created](/files/-MeIbnOsKTumIC0ddZvC)

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeilne code is verified using 'Verify' button as shown above.](/files/-MeIckMghdS8zqlmCZ1Z)

Step 4:  Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

![Successful execution of pipeline without any errors](/files/-MeIdbPf8bQn1aEttoGe)

Step 5: RDA uses the 'match' function to match a regular expression from a selected column, picks up that value, applies regular expression, stores it in the new column (IP Address), and prints it to the screen as shown below.

![Successful execution of pipeline using dm function 'match' with regex to print only IP addresses.](/files/-MeIgQ7NdAV9dgnz-QtI)

### Example 2:&#x20;

Step 1: Create an empty **match\_example\_2** using AIOps studio as shown in the below screenshot. 

![Empty pipeline ](/files/-MeIsUWVkxX4Y4JiOV3b)

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a list of rows with hostname and ipaddress`*\
*`##### RDA dm function 'match' used to demo this example. In this pipeline, each row added`*\
*`##### has a column with IPAddress and hostname.`*\
\
*`##### Pipeline uses RDA dm function match to match to regular expression to pick only`* \
*`##### hostname from FQDN from the dataset.`*\
\
*`@dm:empty`* \
*`--> @dm:addrow id = 'a1' & APP_Client_FQDN = "host1.acme.com"`*\
*`--> @dm:addrow id = 'a2' & APP_Client_FQDN = "host2.acme.com"`*\
*`--> @dm:addrow id = 'a3' & APP_Client_FQDN = "host3.acme.com"`*\
*`--> @dm:addrow id = 'a4' & APP_Client_FQDN = "172.17.0.1"`*\
*`--> @dm:addrow id = 'a5' & APP_Client_FQDN = "192.168.60.120"`*\
*`--> @dm:addrow id = 'a6' & APP_Client_FQDN = "172.17.0.4"`*\
*`--> @dm:addrow id = 'a7' & APP_Client_FQDN = "172.17.0.3"`*\
*`--> @dm:map func = 'match' & from = 'APP_Client_FQDN' & to = 'Hostname' & expr = "(.*).acme.com"`*<br>

![Pipeline code added to empty pipeline created](/files/-MeIzlOrk4_8zhqC1-rp)

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeilne code is verified using 'Verify' button as shown above.](/files/-MeJ-7pTW9P6zdtmEyUP)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

![Successful execution of pipeline without any errors](/files/-MeJ-bOpipDqG0qBZve3)

Step 5: RDA uses the 'match' function to match a regular expression from a selected column, picks up that value, applies regular expression, stores it in the new column (hostname), and prints it to the screen as shown below.

![Successful execution of pipeline using dm function 'match' with regex to print only hostname.](/files/-MeJ0AEu8Etwh1JgeA2Q)

### Example 3:&#x20;

Step 1: Create an empty **match\_example\_3** using AIOps studio as shown in the below screenshot. 

![Empty pipeline ](/files/-MeMeZgkCb9hoeXCc61y)

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a list of rows with hostname and ipaddress`*\
*`##### RDA dm function 'match' used to demo this example. In this pipeline, each row added`*\
*`##### has a column with IPAddress and hostname.`*\
\
*`##### Pipeline uses RDA dm function match to match to regular expression to pick FQDN`* \
*`##### and excluding IP Addresses from the dataset.`*\
\
*`@dm:empty`* \
*`--> @dm:addrow id = 'a1' & APP_Client_FQDN = "host1.acme.com"`*\
*`--> @dm:addrow id = 'a2' & APP_Client_FQDN = "host2.acme.com"`*\
*`--> @dm:addrow id = 'a3' & APP_Client_FQDN = "host3.acme.com"`*\
*`--> @dm:addrow id = 'a4' & APP_Client_FQDN = "172.17.0.1"`*\
*`--> @dm:addrow id = 'a5' & APP_Client_FQDN = "192.168.60.120"`*\
*`--> @dm:addrow id = 'a6' & APP_Client_FQDN = "172.17.0.4"`*\
*`--> @dm:addrow id = 'a7' & APP_Client_FQDN = "172.17.0.3"`*\
*`--> @dm:map func = 'match' & from = 'APP_Client_FQDN' & to = 'Hostname' & expr =`* \
*`"^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$"`*<br>

![Pipeline code added to empty pipeline created](/files/-MeMgAST6tmg0w512GVj)

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeilne code is verified using 'Verify' button as shown above.](/files/-MeMgup3h8hpkoIOguiA)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

![Successful execution of pipeline without any errors](/files/-MeMhOhM9KA55v28uJfE)

Step 5: RDA uses the 'match' function to match a regular expression from a selected column, picks up that value, applies regular expression, stores it in the new column (FQDN - hostname.domain), and prints it to the screen as shown below.

![Successful execution of pipeline using dm function 'match' with regex to print only FQDN.](/files/-MeMi-1aZhmmVG6TJ0D5)

Note: Each of the above examples is using different expressions (regular expressions)  to extract patterns to match criteria and output required data from the dataset. Also,  you can remove the rows with 'None' values using  the dm function "@dm:fixnull columns = 'Hostname'"&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cloudfabrix.io/rda/rda-userguide/rda-aiops-studio/examples-jupyter/data-mapping-cfxdm-dm-functions/match.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
