Try it free

DPL Array

  • Latest Dynatrace
  • Reference

ARRAY

ARRAY{ matcher_expression }{min,max} matches a repeated sequence of elements that share the same pattern, applying the element pattern matcher_expression—enclosed in braces—until it no longer matches or reaches the maximum number of repetitions, and collects each match into an array.

Use the following expression to parse a comma-separated list of integers into an array:

ARRAY{ INT:n ','? }{1,5}:result

For example:

Descriptioninput (string)result (array)

Multiple elements

2,3,7

[2, 3, 7]

Single element

42

[42]

Several elements

2,3,7,7,1

[2, 3, 7, 7, 1]

More than the maximum

2,3,7,7,1,9

[2, 3, 7, 7, 1]

Stops at first non-matching element

2,3,a,7

[2, 3]

No match

abc

null

Whitespace

␣

null

Space instead of separator

2␣3,7,7,1

[2]

Missing element

2,3,,7,1

[2, 3]

See how to use in DQL
data record(input = "2,3,7"),
record(input = "42"),
record(input = "2,3,7,7,1"),
record(input = "2,3,7,7,1,9"),
record(input = "2,3,a,7"),
record(input = "abc"),
record(input = " "),
record(input = "2 3,7,7,1"),
record(input = "2,3,,7,1")
| parse input, "ARRAY{ INT:n ','? }{1,5}:result"

Syntax

ARRAY{ matcher_expression }( parameter = value, ... ){ min, max }:result

Configuration

parametertypeDescription

locale

string

An IETF BCP 47 language tag enclosed in single or double quotes. Enables locale-specific parsing in the element matchers, such as localized month and day names. Default: English.

charset

string

A character set name enclosed in single or double quotes (for example, charset="ISO-8859-1") used to decode the input. Default: UTF-8.

Quantifier

The quantifier is required and has no default.

parametertypeDescription

min

integer

Minimum number of repetitions, as a non-negative integer. If fewer than min elements match, parsing fails and the output returns null. Omit it to default to 0, as in {,max}.

max

integer

Maximum number of repetitions, greater than or equal to min. Once max elements have matched, parsing stops. Omit it for no upper limit ({min,}); the maximum allowed value is 32768.

Returns

The data type of the extracted value is array. Each element keeps the data type of the matcher used inside the braces.

Basic example

Example: Match the number of elements

The following pattern checks whether the input is a slash-separated list of 3 to 5 integers. Because matchesPattern anchors to the whole input, an input with more than the maximum number of elements does not match:

ARRAY{ INT*:n '/'? }{3,5}

The * quantifier on INT makes each slot in the body optional: when no integer precedes the separator, the slot still counts as an element (with a null value). Without *, every element must contain at least one integer, so consecutive separators like 1//3 or a leading separator like /1/2/3 stop the count and the match fails.

Descriptioninput (string)result (boolean)

Within range

1/2/3

true

Too few elements

1/2

false

More than the maximum

1/2/3/4/5/6/7

false

Consecutive separators

1//3

true

Leading separator

/1/2/3

true

See how to use in DQL
data record(input = "1/2/3"),
record(input = "1/2"),
record(input = "1/2/3/4/5/6/7"),
record(input = "1//3"),
record(input = "/1/2/3")
| fieldsAdd result = matchesPattern(input, "ARRAY{ INT*:n '/'? }{3,5}")

Practical examples

Example 1: Parse a comma-separated tag list

Given the following input:

tags=alpha,beta,gamma

Use the following pattern to extract the tags into an array:

'tags=' ARRAY{ WORD:tag ','? }{1,20}:tags
tags (array)

["alpha", "beta", "gamma"]

See how to use in DQL
data record(input = "tags=alpha,beta,gamma")
| parse input, "'tags=' ARRAY{ WORD:tag ','? }{1,20}:tags"
Example 2: Parse localized month names with a locale

Given the following input with German month names:

März;Juli;Dezember

Use the following pattern to parse the months into an array of timestamps. The locale configuration makes the inner TIMESTAMP matcher recognize German month names:

ARRAY{ TIMESTAMP('MMMM'):month ';'? }(locale='de'){1,20}:months
months (array)

["2026-03-01T00:00:00.000Z", "2026-07-01T00:00:00.000Z", "2026-12-01T00:00:00.000Z"]

See how to use in DQL
data record(input = "März;Juli;Dezember")
| parse input, """ARRAY{ TIMESTAMP('MMMM'):month ';'? }(locale='de'){1,20}:months"""
Example 3: Parse repeated key-value samples into an array of records

Given the following input:

cpu=80;mem=45;disk=90

When the element pattern captures more than one field, each repetition becomes a record. Use the following pattern to extract every metric=value pair:

ARRAY{ WORD:metric '=' INT:value ';'? }{1,20}:samples
samples (array)

[{"metric": "cpu", "value": 80}, {"metric": "mem", "value": 45}, {"metric": "disk", "value": 90}]

See how to use in DQL
data record(input = "cpu=80;mem=45;disk=90")
| parse input, "ARRAY{ WORD:metric '=' INT:value ';'? }{1,20}:samples"
Example 4: Parse a column from a multi-line report

Given the following tablespace report:

input (string)
Status Name Type Extent Man Initial Extent Size (M) Used (MB) Used %
--------- -------------- ---------- --------------- ------------------ ------------ ------------ --------------
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.73
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.72
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.71
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.79

Use the following pattern to collect the Used % value from every line into an array. DATA skips the rest of each line, and the lookahead >> (EOL|EOS) anchors the value to the end of the line, so only the last column is captured instead of the earlier numbers:

ARRAY{ DATA ([0-9]{1,2} '.' [0-9]{2} >> (EOL|EOS)):i }{1,}:result
result (array)

["99.73", "99.72", "99.71", "99.79"]

See how to use in DQL
data record(content = """
Status Name Type Extent Man Initial Extent Size (M) Used (MB) Used %
--------- -------------- ---------- --------------- ------------------ ------------ ------------ --------------
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.73
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.72
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.71
ONLINE SAMPLE_INDEX_X GROUP_ONE EXT_A 65536 908,304.000 905,890.125 99.79
""")
| parse content, "ARRAY{ DATA ([0-9]{1,2} '.' [0-9]{2} >> (EOL|EOS)):i }{1,}:result"
Example 5: Parse NGINX upstream status codes with mixed delimiters

Given the following nginx access log line, where $upstream_status records the result of each upstream attempt. Nginx separates these codes with commas (retries within an upstream group) and colons (between groups after an internal redirect), so the list mixes both:

10.0.3.14 - - [25/Jun/2026:10:42:13 +0000] "GET /api/orders HTTP/1.1" 200 1543 upstream_status: 502, 502 : 200

Use the following pattern to collect every status code into an array. The [,: ]* character class consumes any run of commas, colons, or spaces between elements:

LD 'upstream_status: ' ARRAY{ INT:code [,: ]* }{1,20}:upstream_status
upstream_status (array)

[502, 502, 200]

See how to use in DQL
data record(input = """10.0.3.14 - - [25/Jun/2026:10:42:13 +0000] "GET /api/orders HTTP/1.1" 200 1543 upstream_status: 502, 502 : 200""")
| parse input, "LD 'upstream_status: ' ARRAY{ INT:code [,: ]* }{1,20}:upstream_status"
Related tags
Dynatrace Platform