ARRAY { matcher_expr … }
The ARRAY allows parsing repeated sequences of variable number data elements, specified by a pattern supplied as an argument.
The specified pattern is applied repeatedly until:
Array captures exported data elements in array data type. You must assign an export name to ARRAY to make exported members visible for the query.
Consider data where each line has integers, separated by forward slash "/" (i.e an array), where:
101/102/103201//203//205/302/303/304
In the pattern, we define an ARRAY (lines 1 and 4). It matches for an integer (which can be missing since the quantifier '*' allows to match zero times) followed by a forward slash (which can also be missing by applying optional modifier '?', to match the last element of the array). The array has a quantifier expression on line 4, specifying min 3 and max 5 elements to be matched and it also assigns the export name to array expression. Out record ends with an EOL matching with line feed:
ARRAY{INT*:i'/'?}{3,5}:int_arrayEOL;
Parsing results with line 1 evaluated to an array with 3 members, line 2 array with five members and line 3 array with four members (note NULL values for missing integers).
| int_array |
|---|
[101, 102, 103] |
[201, null ,203, null, 205] |
[null, 302, 303, 304] |