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

# matches

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

## matches(String, 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/2.3/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 ]
```
