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:

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}';

Author: Alex T. Silverstein

A developer who wants to help you and himself by writing down good tidbits for free

Leave a Reply

Your email address will not be published. Required fields are marked *