Giter VIP home page Giter VIP logo

Comments (11)

marbemac avatar marbemac commented on July 21, 2024

For those wondering how to validate a UUID v4, the regex looks like this (in JS, but generally applicable):

var id = "the id to test";
/^[a-z0-9]{8}-[a-z0-9]{4}-4[a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}$/.test(id)

from uuid.

tracker1 avatar tracker1 commented on July 21, 2024

@NatWeiss @tjconcept might want to take a look at validator, which will give you a lot more than just UUID validation.

from uuid.

tjconcept avatar tjconcept commented on July 21, 2024

@tracker1 "a lot more" is a bad thing in my book ;-)
Thanks @marbemac, I still think it would be a nice addition to this library though.

from uuid.

marbemac avatar marbemac commented on July 21, 2024

@tjconcept I agree, would be a nice addition to the library.

from uuid.

tracker1 avatar tracker1 commented on July 21, 2024

@tjconcept @marbemac Although I understand the concern... I'm assuming you have to validate more than just UUIDs in your application... that being the case a common abstract for validation is probably better than a custom one for each type of data.

from uuid.

lianghua1987 avatar lianghua1987 commented on July 21, 2024

Yeah, I like this idea!

from uuid.

tjconcept avatar tjconcept commented on July 21, 2024

I'm assuming you have to validate more than just UUIDs in your application...

No I don't :)

from uuid.

vdininski avatar vdininski commented on July 21, 2024

+1

from uuid.

jtemplet avatar jtemplet commented on July 21, 2024

I also think this would be a great idea and I also like the syntax suggested above:

nodeUuid.isValid(input)
// returns boolean

I'd volunteer to add this feature

from uuid.

jiayihu avatar jiayihu commented on July 21, 2024

+1
Is this repo still active? I'd like also to add this feature but the pending Pull Requests are not reassuring.

from uuid.

mindvox avatar mindvox commented on July 21, 2024

This is an old issue, but would be a great feature 👍

from uuid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.