How to check for a UUID in Javascript

const uuidPattern = /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/;

function isUuid(input){
  if (uuidPattern.test(input)) {
    return true;
  }
}
comments powered by Disqus