---
schema_version: "1"
id: edaac888c6cf6a980b3434b81a4ffa718713f0f6b0d8ae8a0ae21a332e56049b
title: match
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-core-functions-match.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-core-functions-match
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0185ee72a4c415359fa28324aefee7aaba36635fce827ab0de9d41cf981b1f44
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# match

## [](#match1)match(String, Regex): Array<String>

Java 正規表現 (regex) を使用して文字列を照合して各キャプチャグループに分割します。結果を配列で返します。

`match`​ は、 [case ステートメント](https://docs.mulesoft.com/mule-runtime/4.3/dataweave-pattern-matching)を含むパターン一致式で使用できます。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>text</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">文字列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>matcher</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>text</code>​ 内の文字を照合する Java 正規表現。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例の正規表現は入力のメールアドレスを照合し、括弧内に 2 つのキャプチャグループ (​`@`​ の前と後) を含みます。結果は要素の配列です。1 つ目は正規表現全体と一致し、2 つ目は正規表現内の最初のキャプチャグループ (​**​) と一致し、3 つ目は最後のキャプチャグループ (​`[a-z]`**​) と一致します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
output application/json
---
"me@mulesoft.com" match(/([a-z]*)@([a-z]*).com/)
```

#### [](#出力)出力

```JSON
[
  "me@mulesoft.com",
  "me",
  "mulesoft"
]
```

### [](#例-2)例

次の例では、末尾が ​`4`​ である配列内の値への一致を出力します。これは ​`flatMap`​ を使用して、リストを反復処理し、フラット化します。

#### [](#ソース-2)ソース

```DataWeave
%dw 2.0
var a = '192.88.99.0/24'
var b = '192.168.0.0/16'
var c = '192.175.48.0/24'
output application/json
---
[ a, b, c ] flatMap ( $ match(/.*[$4]/) )
```

#### [](#出力-2)出力

```JSON
[  "192.88.99.0/24", "192.175.48.0/24" ]
```