Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 53bc5f4

Browse files
Dart Teamalan-knight
Dart Team
authored andcommitted
Fix extension value assert regexps: they are "alphanum", not "alpha".
PiperOrigin-RevId: 241411050
1 parent 4b27a88 commit 53bc5f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/src/locale/locale_extensions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class LocaleExtensions {
8585
//
8686
// Must be static to get tree-shaken away in production code.
8787
static final _uExtensionsValidValuesRE =
88-
RegExp(r'^[a-z]{3,8}([-][a-z]{3,8})*$');
88+
RegExp(r'^[a-z\d]{3,8}([-][a-z\d]{3,8})*$');
8989

9090
/// For debug/assert-use only! Matches keys considered valid for
9191
/// [_tExtensions], does not imply keys are valid as per Unicode LDML spec!
@@ -99,7 +99,7 @@ class LocaleExtensions {
9999
//
100100
// Must be static to get tree-shaken away in production code.
101101
static final _tExtensionsValidValuesRE =
102-
RegExp(r'^[a-z]{3,8}([-][a-z]{3,8})*$');
102+
RegExp(r'^[a-z\d]{3,8}([-][a-z\d]{3,8})*$');
103103

104104
/// For debug/assert-use only! Matches keys considered valid for
105105
/// [_otherExtensions], does not imply keys are valid as per Unicode LDML

test/locale_test_data.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ Map<String, String> localeParsingTestData = <String, String>{
4646
// Private-use extension subtags do not get sorted
4747
'en-x-BCDE0123-ABCD0123': 'en-x-bcde0123-abcd0123',
4848
'en-x-BCDE0123-123456-ABCD0123': 'en-x-bcde0123-123456-abcd0123',
49+
50+
// Digits in u-extension values
51+
'en-u-hc-h11': 'en-u-hc-h11',
52+
'en-u-hc-h23': 'en-u-hc-h23',
53+
54+
// Digits in t-extension values
55+
'en-t-m0-c11': 'en-t-m0-c11',
4956
};
5057

5158
/// Invalid Language Tags.

0 commit comments

Comments
 (0)