---
schema_version: "1"
id: c8c759dc246afbe2e0bf10ffc26afe17d1de71a2281d7f56130b731a40b3d152
title: matches
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-core-functions-matches.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-core-functions-matches
source_site: docs.mulesoft.com
content_type: documentation
content_hash: b007a5e0a15e4a5d6848e244309c2b92988e21ebe0157cb863b257e9a37df513
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# matches

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## matches(text: String, matcher: Regex): Boolean

Checks if an expression matches the entire input string.

For use cases where you need to output or conditionally process the matched value, see
[Pattern Matching in DataWeave](https://docs.mulesoft.com/dataweave/latest/dataweave-pattern-matching).

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The input string.</p></td></tr><tr><td><p><code>matcher</code></p></td><td><p>A Java regular expression for matching characters in the string.</p></td></tr></tbody></table>

### Example

This example indicates whether the regular expression matches the input text. Note that you can also
use the `matches(text,matcher)` notation (for example, `matches("admin123", /a.*\d+/)`).

#### Source

```DataWeave
%dw 2.0
output application/json
---
[ ("admin123" matches /a.*\d+/), ("admin123" matches /^b.+/) ]
```

#### Output

```JSON
[ true, false ]
```

## matches(text: Null, matcher: Any): false

Helper function that enables `matches` to work with a `null` value.

_Introduced in DataWeave version 2.4.0._
