%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
toRegexEx1: toRegex("a-Z"),
toRegexEx2: toRegex("0-9+")
}
DataWeave
toRegex
toRegex(str: String): Regex
Transforms a String
value into a Regex
value.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The |
Example
This example shows how toRegex
behaves with different inputs.
It produces output in the application/dw
format.
Source
Output
{
toRegexEx1: /a-Z/,
toRegexEx2: /0-9+/
}
DataWeave