---
title: "matchText"
canonical: "https://support.appfire.com/space/PSCONF/15303138/matchText"
format: markdown
---
> Macro (aura-html)

> Macro (table-plus)
> 
> |  |  |  |  |
> | --- | --- | --- | --- |
> | **Syntax** | matchText(input, regex) | **Package** |  |
> | **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Returns the text matched or empty string if it doesn't match.

Returns the text matched or empty string if it doesn't match.

## Parameters

> Macro (table-plus)
> 
> | Parameter name | Type | Required | Description |
> | --- | --- | --- | --- |
> | input | String | Yes | Specifies a character expression to match the regex against. |
> | regex | String | Yes | Specifies a regular expression to match the specified string. |

## Return Type

**String**

## Example

```javascript
wret = matchText("This will return ?", ".*will");
print("Return " + wret);
```

Returns the string matched at the beginning of the string until "will" word.

  


> ⚠️ For more information on regular expressions, see [Oracle documentation](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).

  


## See also

> Macro (contentbylabel)