rfc5646extlang top-level property

Rule rfc5646extlang
final

As defined in RFC5646, Section 2.2.2. Extended language subtags

Implementation

final rfc5646extlang = rule(
  'extlang',
  concatenation([
    repetition(alpha, 3),
    negativeLookahead(alphanum),
    variableRepetition(
      concatenation([
        literal('-'),
        repetition(alpha, 3),
        negativeLookahead(alphanum),
      ]),
      max: 2,
    ),
  ]),
);