DPL Enum

ENUM { string=integer , … }

Enum constructor allows matching for a set of predefined strings and converts them into respectively assigned integer values. The strings and respective integer values are declared as series of key-value pairs, separated by commas and enclosed in curly brackets.

output type

quantifier

configuration

integer

none

cis = true allows matching string values case insensitively. Default false.

locale = string specifying IETF BCP 47 language tag enclosed in single or double quotes (see the list here). The default locale is English.

charset = character set name enclosed in single or double quotes (for example charset="ISO-8859-1")

Example 23.

Suppose we have data with username, login result and comment fields:

Alice;success;all good
Bob;Wrong password;attempts left 2
Oscar;tech error;
Mallory;;doodaloo

Pattern. Line 3 maps login result strings (case-insensitively) to integer values:

LD:username ';'
ENUM{''=-3, 'success'=0, 'Wrong password'=1, 'tech error'=2}(cis=true):result ';'
LD*:comment
EOL;

Result:

username
result
comment
Alice
0
all good
Bob
1
attempts left 2
Oscar
2
Mallory
-3
doodaloo