📜  javascript 检查格式 uuid - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:13.604000             🧑  作者: Mango

代码示例1
// Regular expression to check if string is a valid UUID
const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;

// String with valid UUID separated by dash
const str = "a24a6ea4-ce75-4665-a070-57453082c256";

regexExp.test(str); // true