Test, validate and match regular expressions
Matches Kubernetes-style pod or container names (lowercase alphanumerics, dots, hyphens) as group 1, optionally stripping a trailing auto-generated suffix consisting of a hyphen plus 8-10 hexadecimal characters (group 2). The lazy first group ensures the longest valid hex suffix is separated from the base name. Typically used in Promtail/Loki pipeline stages to extract a clean service or app name from pod identifiers for log labeling.