Answers for "check if uuid is valid"

0

check if string is uuid

// For test 01234567-9ABC-DEF0-1234-56789ABCDEF0 use Regex
Regex reg = new Regex("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/");

// with brackets
Regex reg = new Regex("/^\{?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}?$/");
// use https://regexr.com/ for a REGEX builder
Posted by: Guest on April-06-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language