Recognises the language tag syntax defined in RFC 5646 § 2.1, excluding grandfathered tags, whatever the case of its
subtags. The pattern is anchored, matching a whole tag and nothing less; carrying no flags, it keeps no state
between tests and may be shared freely.
Reach for it wherever a language tag is to be recognised by a regular expression rather than by a call, as in a
form control or a schema; isTag validates values in code.
Remarks
Case tolerance is built into the expression itself rather than left to an i flag, so that its source carries the
whole grammar wherever flags aren't available.
Regular expression matching BCP 47 language tags.
Recognises the language tag syntax defined in RFC 5646 § 2.1, excluding grandfathered tags, whatever the case of its subtags. The pattern is anchored, matching a whole tag and nothing less; carrying no flags, it keeps no state between tests and may be shared freely.
Reach for it wherever a language tag is to be recognised by a regular expression rather than by a call, as in a form control or a schema; isTag validates values in code.