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

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