Skip to content

Commit f822e80

Browse files
committed
:octocat: regex fix (#282)
1 parent 9964cf8 commit f822e80

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Data/AlphaNum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getLengthInBits():int{
3636
}
3737

3838
public static function validateString(string $string):bool{
39-
return (bool)preg_match('#^['.self::CHAR_MAP.']+$#', $string);
39+
return (bool)preg_match('/^[A-Z\d %$*+-.:\/]+$/', $string);
4040
}
4141

4242
public function write(BitBuffer $bitBuffer, int $versionNumber):static{

tests/Data/AlphaNumTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ public static function stringValidateProvider():array{
3434
return [
3535
['ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:', true],
3636
['abc', false],
37+
['ÄÖÜ', false],
38+
[',', true],
39+
['-', true],
40+
['+', true],
41+
['.', true],
42+
['*', true],
43+
[':', true],
44+
['/', true],
45+
['\\', false],
3746
];
3847
}
3948

0 commit comments

Comments
 (0)