We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb75965 commit 5f5e349Copy full SHA for 5f5e349
src/helpers/Html.php
@@ -737,7 +737,12 @@ public static function id(string $id = ''): string
737
return $id;
738
}
739
740
+ // remove any non-alphanumeric characters that are already preceded/followed by a hyphen
741
+ $id = preg_replace('/(?<=-)[^A-Za-z0-9_.-]+|[^A-Za-z0-9_.-]+(?=-)/', '', $id);
742
+
743
+ // convert any remaining consecutive non-alphanumeric characters to hyphens
744
$id = trim(preg_replace('/[^A-Za-z0-9_.-]+/', '-', $id), '-');
745
746
return $id ?: StringHelper::randomString(10);
747
748
0 commit comments