Identifiers
Kubernetes Label (key=value)
Validate Kubernetes label `key=value` pairs per the K8s naming spec.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
^([a-zA-Z0-9](?:[\w.\-]{0,61}[a-zA-Z0-9])?)=([a-zA-Z0-9](?:[\w.\-]{0,61}[a-zA-Z0-9])?)?$Raw source: ^([a-zA-Z0-9](?:[\w.\-]{0,61}[a-zA-Z0-9])?)=([a-zA-Z0-9](?:[\w.\-]{0,61}[a-zA-Z0-9])?)?$
How it works
Both key and value follow the same rule: 1–63 chars, must start AND end with alphanumeric, can contain underscores/dots/hyphens in the middle. The value group is optional (empty values are allowed). Anchored with ^ and $ for strict full-string matching.
Examples
Input
app=myappMatches
app=myapp
Input
version=v1.2.3Matches
version=v1.2.3
Input
-bad=valueNo match
—Common use cases
- •kubectl label / annotation linting
- •Helm chart values validation
- •GitOps tooling (ArgoCD, Flux) policy checks
- •Cluster admission webhook input validation
Related patterns
Kubernetes Pod Name (RFC 1123)
IdentifiersValidate Kubernetes pod names per the RFC 1123 DNS label rules — lowercase, ≤63 chars, no leading/trailing hyphen.
npm Package Name
IdentifiersValidate npm package names including scoped packages (@org/package), per the npm naming spec.
AWS S3 Bucket Name
IdentifiersValidate AWS S3 bucket names per the standard naming rules: 3–63 chars, lowercase, alphanumeric + dots + hyphens.
Python Package Name (PEP 508)
IdentifiersValidate Python distribution package names per PEP 508: letters, digits, dots, underscores, hyphens.