Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: regexp #94

Open
vanodevium opened this issue Nov 30, 2023 · 1 comment
Open

Question: regexp #94

vanodevium opened this issue Nov 30, 2023 · 1 comment

Comments

@vanodevium
Copy link

Please provide correct regex for ULID. Thanx!

@fabiolimace
Copy link

fabiolimace commented Nov 30, 2023

Try this case-insensitive regex:

^[0-7][0123456789ABCDEFGHJKMNPQRSTVWXYZabcdefghjkmnpqrstvwxyz]{25}$
^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$

or this all-uppercase regex:

^[0-7][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}$
^[0-7][0-9A-HJKMNP-TV-Z]{25}$

or this all-lowercase regex:

^[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$
^[0-7][0-9a-hjkmnp-tv-z]{25}$

Note: the first character can only be one of these digits: 0, 1, 2, 3, 4, 5, 6, 7. That's why the regex starts with [0-7]. The remaining 25 characters are from the Crockford base-32 alphabet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants