$uuid = 'http://domain.com/images/123/b85066fc-248f-4ea9-b13d-0858dbf4efc1_small.jpg';
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);
这也可以工作。引用自这里,但我不确定我们是否可以依赖它。
/[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}/
。 - Zoey Mertespreg_match('/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/',$uuid,$matches);
________-____-____-____-____________
的内容。 - Toto