Chars

The chars constraint restricts which characters may appear in a text value. When negated using not_chars, it instead specifies forbidden characters.

This constraint applies only to text nodes and evaluates every character in the value individually.

Type Matrix

The following table summarizes the applicability of the chars constraint.

Node Type

S

Value Type

Details

Integer

Boolean

Float

Text

Text
ValueList[Text]

Restricts the set of allowed characters (chars) or forbidden characters (not_chars).

Date

Time

DateTime

Bytes

TimeDelta

RegEx

Value

ValueList

ValueMatrix

Section

SectionList

SectionWithTexts

NotValidated

Rules for Chars

  1. Basic Semantics: The chars constraint defines a set of allowed characters.

    Validation succeeds only if every character in the text belongs to the union of all specified character sets.

    [server.name]
    type: "text"
    chars: "(a-z)", "[%]", "digits"
    
  2. Multiple Definitions (Union): Multiple values are combined using OR semantics.

    A character is valid if it matches any of the specified ranges, lists, or named sets.

  3. Supported Forms: Each value assigned to chars may be one of the following forms:

    • Character range — enclosed in round brackets, e.g. (a-z)

    • Character list — enclosed in square brackets, e.g. [%*,.]

    • Named range — a predefined keyword, e.g. digits

    [server.name]
    type: "text"
    chars:
        * "(a-z)"    # Character range
        * "[%*,.]"   # Character list
        * "digits"   # Named range
    
  4. Character Ranges: Character ranges are defined as (start-end) where start and end are single Unicode code points.

    • start must have a lower code point than end

    • The expression must contain exactly five code points

    • Combining characters are not allowed

    [server.name]
    type: "text"
    chars: "(a-z)"  # Allows lowercase ASCII letters
    
  5. Character Lists: Character lists are defined as [characters].

    • Each listed character must be unique

    • The outer square brackets are structural; inner characters are literal

    • No escaping is required inside the list

    [server.name]
    type: "text"
    chars: "[0123456789abcdefABCDEF]"  # Hexadecimal digits
    
  6. Named Ranges: Values not enclosed in brackets are interpreted as named ranges.

    The following named ranges are defined by ELCL and must be supported by all implementations:

    Name

    Definition

    letters

    a-z, A-Z

    digits

    0-9

    control

    U+0001U+001F, U+007FU+00A0

    linebreak

    U+000D, U+000A

    spacing

    U+0009, U+0020

    Implementations may provide additional named ranges (for example, Unicode classes). Such extensions must not override built-in names.

    To avoid ambiguity, custom ranges should use descriptive prefixes such as unicode_letters.

  7. Case Sensitivity: Character matching is always case-sensitive, regardless of the case-sensitive flag.

    Both uppercase and lowercase characters must be explicitly listed if required.

    [server.name]
    type: "text"
    chars: "[a-z]", "[A-Z]"
    
  8. Negation with ``not_chars``: When negated as not_chars, the constraint specifies forbidden characters.

    Validation fails if any character in the text matches one of the forbidden sets.

    Design Rationale

    Negating the entire constraint naively would allow strings that merely contain at least one allowed character, which is unintuitive.

    Instead, not_chars makes every occurrence of the forbidden characters invalid.

    Example: not_chars: "(a-z)" rejects "123abc" because it contains forbidden lowercase letters.

    [server.name]
    type: "text"
    not_chars: "control"  # Control characters are forbidden