MySQL How-To: Match a GUID in a MySQL Regex (Regular Expression)

Here’s a handy regular expression you can use to match guids (values generated by MySQL’s UUID function or by other code) in a MySQL column:

SELECT *
FROM your_table
WHERE guid_column REGEXP '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}';