Split
Anatomy
<split var="var" limit="(no limit)" delimiter="string" pattern="regexp">
string
</split>
Description: SPLIT splits a subject along boundaries formed by a given delimiter or matched by a given pattern.
Attributes
| Name | Type | Description | Defined By |
|---|---|---|---|
| var | var | Result variable name | split |
| limit | int | Limit | split |
Basic
| Name | Type | Description | Defined By |
|---|---|---|---|
| delimiter | string | Delimiter | split |
Regular expression
| Name | Type | Description | Defined By |
|---|---|---|---|
| pattern | regexp | Pattern | split |
Results:
| Binding | Type | Predicate |
|---|---|---|
| var | array | no-result-propagation |
Examples
Basic split
<split var="names" delimiter=", ">Bill Gates, Steve Jobs</split>
<output>$names[0]</output>
<!-- Bill Gates -->
Regular expression split
<split var="names" pattern="/,\s?/">Bill Gates, Steve Jobs</split>
<output>$names[1]</output>
<!-- Steve Jobs -->