Skip to content

Commit

Permalink
feat: modyfy qti identifier regex
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomiejmarszal committed Jun 28, 2024
1 parent 4621e1f commit d6b76e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qtism/common/utils/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Format
public static function isIdentifier(string $string, bool $strict = true): bool
{
if (!$strict) {
return preg_match("/^[a-zA-Z_][a-zA-Z0-9_\.-]*$/u", $string) === 1;
return preg_match("/^[a-zA-Z0-9_][a-zA-Z0-9_\.-]*$/u", $string) === 1;
}

if (!isset($string[0]) || !isset(CharacterMap::$identifier_first[$string[0]])) {
Expand Down Expand Up @@ -130,7 +130,7 @@ public static function isIdentifier(string $string, bool $strict = true): bool
*/
public static function sanitizeIdentifier(string $dirtyIdentifier): string
{
if (preg_match("/^[a-zA-Z_][a-zA-Z0-9_\.-]*$/u", $dirtyIdentifier)) {
if (preg_match("/^[a-zA-Z0-9_\.-]*$/u", $dirtyIdentifier)) {
return $dirtyIdentifier;
}

Expand Down

0 comments on commit d6b76e1

Please sign in to comment.