3 namespace Drupal\Component\Uuid;
11 * The pattern used to validate a UUID string.
13 const VALID_PATTERN = '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}';
16 * Checks whether a string appears to be in the format of a UUID.
18 * Implementations should not implement validation, since UUIDs should be in
19 * a consistent format across all implementations.
25 * TRUE if the string is well formed, FALSE otherwise.
27 public static function isValid($uuid) {
28 return (bool) preg_match('/^' . self::VALID_PATTERN . '$/', $uuid);