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

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