ansman/validate.js

Requesting UUID/GUID v4 validator (regex inside)

Opened this issue · 1 comments

Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-Yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, a, or b.

Regex equiv /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i

Alternatively you can use validator's function. They have a lot of string validations.