Pav Pav - 1 year ago 200
PHP Question

PHP preg_match UUID v4

I've got a string that contains UUID v4

$uuid = '';

How would i get the
value from the above using

More info on UUID v4 can be be found here

Answer Source
$uuid = '';
preg_match('!/images/\d+/([a-z0-9\-]*)_!i', $uuid, $m);


preg_match('/[a-f0-9]{8}\-[a-f0-9]{4}\-4[a-f0-9]{3}\-(8|9|a|b)[a-f0-9]{3‌​}\-[a-f0-9]{12}/', $uuid, $m);

works too. Taken from here, but I don't know if we can rely on that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download