1.20.x uuid.inc public Uuid::isValid($uuid)

Check that a string appears to be in the format of a UUID.

Plugins should not implement validation, since UUIDs should be in a consistent format across all plugins.

Parameters

$uuid: The string to test.

Return value

TRUE if the string is well formed.:

File

includes/uuid.inc, line 65
Handling of universally unique identifiers.

Class

Uuid
Factory class for UUIDs.

Code

public function isValid($uuid) {
  return preg_match("/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/", $uuid);
}