LanguageInterface::VALID_LANGCODE_REGEX

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Language/LanguageInterface.php \Drupal\Core\Language\LanguageInterface::VALID_LANGCODE_REGEX
  2. 10 core/lib/Drupal/Core/Language/LanguageInterface.php \Drupal\Core\Language\LanguageInterface::VALID_LANGCODE_REGEX
  3. 11.x core/lib/Drupal/Core/Language/LanguageInterface.php \Drupal\Core\Language\LanguageInterface::VALID_LANGCODE_REGEX

A regex for validating language codes according to W3C specifications.

See also

https://www.w3.org/International/articles/language-tags/

File

core/lib/Drupal/Core/Language/LanguageInterface.php, line 61

Class

LanguageInterface
Defines an interface for languages.

Namespace

Drupal\Core\Language

Code

const VALID_LANGCODE_REGEX = '[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*';

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.