Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

A regular expression that groks UUIDs

by fbicknel (Sexton)
on Nov 01, 2013 at 17:55 UTC ( #1060802=CUFP: print w/ replies, xml ) Need Help??

m/^[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}$/

Humbly submitted.

Fun activity: add groupings to parse bits (words) of it out if you're so inclined. (See RFC 4122 for the bits' meanings. Also likely better done through unpack, but I warned you this was a fun activity.)
($time_low) = $uuid =~ m/^([[:xdigit:]]{8})-(?:[[:xdigit:]]{4}-){3}[[: +xdigit:]]{12}$/

Comment on A regular expression that groks UUIDs
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1060802]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-09-20 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (155 votes), past polls