> ## Documentation Index
> Fetch the complete documentation index at: https://docs.avicenna.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Match Regex

> Match or extract patterns from text using regular expressions

The **Match Regex** action allows you to apply [regular expression (regex)](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference) patterns to pieces of text to find and extract matching strings.

<Frame>
  <img src="https://mintcdn.com/avicenna-a10e7e50/u8ENZJdfPeXPOFIU/images/image-15.png?fit=max&auto=format&n=u8ENZJdfPeXPOFIU&q=85&s=2872d6d66fb28eb0f5088d151ec61327" alt="Image" title="Image" width="639" height="235" data-path="images/image-15.png" />
</Frame>

***

### Input Text

The **input text** is the base text value that will be searched for the regex pattern. This can be static text or a variable.

### Pattern

The **pattern** is a regex expression that will be used to search for matches in the input text. This can be static text or a variable. Refer to [this reference](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference) for help writing regex.

### Reference Variables

<Frame>
  <img src="https://mintcdn.com/avicenna-a10e7e50/77U4CSLJ5ujBPG6Z/images/Screenshot-2026-05-26-at-4.53.17-PM.png?fit=max&auto=format&n=77U4CSLJ5ujBPG6Z&q=85&s=fd94844e1a523e88130a7f02adcbc6a4" alt="Screenshot 2026 05 26 At 4 53 17 PM" width="866" height="324" data-path="images/Screenshot-2026-05-26-at-4.53.17-PM.png" />
</Frame>

These variables allow you to refer to the result of the regex match in future action blocks down your endpoint's flow. A custom name must be assigned to to refer to these variables

<Tip>
  Make your reference variable names as descriptive and unique as possible to prevent your endpoint flow from becoming cluttered. If a future variable is assigned the same name, the value of your reference variable will be overriden.
</Tip>

The following variables will be generated based off of your custom name:

* `{result.[NAME].matches}` for any matches not included in capture groups
* `{result.[NAME].captures}` for any matches included in capture groups
* `{result.[NAME].[CAPTURE_GROUP_NAME]}` for any matches included in named capture groups
* `{result.[NAME].isMatch}` for a true/false boolean result indicating whether any match was found
