Identifiersflags: g
ULID
Match 26-character ULIDs (Universally Unique Lexicographically Sortable Identifiers).
Try it in RegexPro →Available in
JavaScript / ECMAScript code
jsJavaScript
const re = new RegExp("\\b[0-9A-HJKMNP-TV-Z]{26}\\b", "g");
const input = "01ARZ3NDEKTSV4RRFFQ69G5FAV";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).
Python (re) code
pyPython
import re
pattern = re.compile(r"\b[0-9A-HJKMNP-TV-Z]{26}\b")
input_text = "01ARZ3NDEKTSV4RRFFQ69G5FAV"
for m in pattern.finditer(input_text):
print(m.group(0))Stdlib `re` module — no third-party dependency. Works on Python 3.6+.
Go (RE2) code
goGo
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`\b[0-9A-HJKMNP-TV-Z]{26}\b`)
input := `01ARZ3NDEKTSV4RRFFQ69G5FAV`
for _, match := range re.FindAllString(input, -1) {
fmt.Println(match)
}
}Uses `regexp.MustCompile` (panics on bad patterns at startup) and `FindAllString` for all matches.
Pattern
regexengine-agnostic
\b[0-9A-HJKMNP-TV-Z]{26}\b (flags: g)Raw source: \b[0-9A-HJKMNP-TV-Z]{26}\b
How it works
ULIDs use Crockford Base32 which excludes I, L, O, U to avoid confusion. Exactly 26 characters, word-bounded.
Examples
Input
01ARZ3NDEKTSV4RRFFQ69G5FAVMatches
01ARZ3NDEKTSV4RRFFQ69G5FAV
Common use cases
- •Event sourcing ID validation
- •API request correlation
- •Time-ordered record indexing
- •Migration from UUIDs
Related patterns
MongoDB ObjectId
IdentifiersMatch MongoDB ObjectId values — 24-character hexadecimal strings.
AWS ARN (Amazon Resource Name)
IdentifiersMatch AWS ARNs (Amazon Resource Names) across commercial, China, and GovCloud partitions.
AWS S3 Bucket Name
IdentifiersValidate AWS S3 bucket names per the standard naming rules: 3–63 chars, lowercase, alphanumeric + dots + hyphens.
Docker Image Tag
IdentifiersMatch Docker image references with an explicit tag — e.g. nginx:1.21, mycorp/service:v2.3.1.