Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check format uuid

// Regular expression to check if string is a valid UUID
const regexExp = /^[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}$/gi;

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

regexExp.test(str); // true
Source by melvingeorge.me #
 
PREVIOUS NEXT
Tagged: #javascript #check #format #uuid
ADD COMMENT
Topic
Name
7+1 =