<?php $uuid = "1111-1111-1111-1111"; function printResults($str) { if (eregi("^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", $str)) { printf("'%s' is a valid GUID/UUID.\n", $str); } else { printf("'%s' is NOT a valid GUID/UUID.\n", $str); } } printResults($uuid); ?>