Split string in dataweave
<p>I have a string like "Hi I am from "Kazan, Russia". The output should be</p>

<pre><code>Hi
I
am
from
Kazan, Russia
</code></pre>

<p>I tried the regex <code>[^\s\"']+|\"([^\"]*)\"|'([^']*)'</code>, which works fine on <a href="http://www.regexpal.com/" rel="nofollow">regexp.com</a>. But in dataweave it does nothing.
This is what I tried</p>

<pre><code>%dw 1.0
%output application/json
%function split(data) {returnData: data splitBy "[^\s\"']+|\"([^\"]*)\"|'([^']*)'"}
---
split(payload)[0]
</code></pre>

<p><strong>Edit 1</strong></p>

<p>I tried <strong>scan</strong> operator<br>This is what I did<br></p>

<pre><code>%dw 1.0
%output application/json
---
{
payload: payload scan /[^\s\"']+|\"([^\"]*)\"|'([^']*)'/
}
</code></pre>

<p>But I am getting <code>NullPointerException</code><br>
<strong>Stack trace</strong><br></p>

<pre><code>Message               : null (java.lang.NullPointerException).
Payload               :      com.mulesoft.weave.reader.DefaultSeekableStream@5d334a28
Element               : /logFlow/processors/0 @ log:log.xml:14 (Transform Message)
Element XML           : &lt;dw:transform-message doc:name="Transform Message" metadata:id="87d4353c-240d-4b1c-84b4-171f6c11045b"&gt;
                    &lt;dw:input-payload mimeType="plain/text"&gt;&lt;/dw:input-payload&gt;
                    &lt;dw:set-payload&gt;%dw 1.0%output application/json---{payload: payload scan /[^\s\"']+|\"([^\"]*)\"|'([^']*)'/}&lt;/dw:set-payload&gt;
                    &lt;/dw:transform-message&gt;
</code></pre>