Skip to content

Instantly share code, notes, and snippets.

@ppazos
Created May 11, 2018 23:40
Show Gist options
  • Save ppazos/37ad4ba431ec2e9831f35bfa10da28b2 to your computer and use it in GitHub Desktop.
Save ppazos/37ad4ba431ec2e9831f35bfa10da28b2 to your computer and use it in GitHub Desktop.
UUID format matcher in groovy
def uuids = ['a4c0064a-74fc-41e2-a5e0-0492ed2d79a7', '', 'fdgsfgsg', '345']
uuids.each {
def matcher = (it ==~ /([a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})/)
if (matcher) println it + " OK"
else println it + " NO"
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment