---
schema_version: "1"
id: ca59e3d39499be244980af40464dd7940843b602895a803f0db86c3118bdeb8b
title: toRegex
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-coercions-functions-toregex.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-coercions-functions-toregex
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 4c0895df51839f2628263c0134e7d5bb7142d3c66f222014ee6fd03123ae4942
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# toRegex

## [](#toregex1)toRegex(str: String): Regex

`String`​ 値を ​`Regex`​ 値に変換します。

_DataWeave バージョン 2.4.0 で導入されました。_​

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

<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>str</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>Regex</code>​ 値に変換する ​<code>String</code>​ 値。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力での ​`toRegex`​ の動作を示します。 `application/dw`​ 形式の出力が生成されます。

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

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
  toRegexEx1: toRegex("a-Z"),
  toRegexEx2: toRegex("0-9+")
}
```

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

```DataWeave
{
  toRegexEx1: /a-Z/,
  toRegexEx2: /0-9+/
}
```