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

# 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._
