Skip to content

About

Check if a Minecraft UUID is valid via Regular Expressions.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Minecraft UUID RegEx

RegEx for both dashless and dashed UUIDs provided by drainer / swede

/([0-9a-f]{8})(?:-|)([0-9a-f]{4})(?:-|)(4[0-9a-f]{3})(?:-|)([89ab][0-9a-f]{3})(?:-|)([0-9a-f]{12})/

if you are using this as a pattern remove the slashes

RegEx for UUID with dashes

/^[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}$/i

RegEx for UUID without dashes

/^[A-F\d]{8}[A-F\d]{4}4[A-F\d]{3}[89AB][A-F\d]{3}[A-F\d]{12}$/i

Usage

if (/([0-9a-f]{8})(?:-|)([0-9a-f]{4})(?:-|)(4[0-9a-f]{3})(?:-|)([89ab][0-9a-f]{3})(?:-|)([0-9a-f]{12})/.test('UUID_Here') === true) {
  console.log('This is a valid UUID.');
} else {
  console.log('This UUID is invalid.');
}

About

Check if a Minecraft UUID is valid via Regular Expressions.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors