%dw 2.0 output application/json --- flatten("www.mulesoft.com" scan(/([w]*).([a-z]*).([a-z]*)/))
DataWeave 2.2 is compatible and bundled with Mule 4.2. Standard Support for Mule 4.2 ended on May 2, 2021, and this version of Mule will reach its End of Life on May 2, 2023, when Extended Support ends.
Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.
MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.
Returns an array with all of the matches found in an input string.
Each match is returned as an array that contains the complete match followed by any capture groups in your regular expression (if present).
The input string to scan.
A Java regular expression that describes the pattern match in
In this example, the
regex describes a URL. It contains three capture
groups within the parentheses, the characters before and after the period
.). It produces an array of matches to the input URL and the capture
groups. It uses
flatten to change the output from an array of arrays into
a simple array. Note that a
regex is specified within forward slashes (
In the example, the
regex describes an email address. It contains two
capture groups, the characters before and after the
@. It produces an
array matches to the email addresses and capture groups in the input string.
%dw 2.0 output application/json --- "firstname.lastname@example.org,email@example.com" scan(/([a-z]*)@([a-z]*).com/)