How do I validate that a value is equal to the UUID4 generated by this code?
uuid.uuid4().hex
Should it be some regular expression? The values generated of 32-character-long strings of this form:
60e3bcbff6c1464b8aed5be0fce86052
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Easy enough:
This matches only for strings that are exactly 32 hexadecimal characters, provided you use the
.match()method (searches from the start of the string, see.search()vs..match()). The\Zmatches the end of the string (vs.$which would match at the end of a string or a newline).