📜  检查字符串是否为 uuid - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:28.303000             🧑  作者: Mango

代码示例1
// 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