Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(:(=[^:\/]{4,253})(?!-)[a-zA-Z0-9-]{1,63}(?<!-)(?:\.(?!-)[a-zA-Z0-9-]{1,63}(?<!-))*(?::[0-9]{1,5})?\/)?(?<image>(?![._-])(?:(?:[a-z0-9._-]*(?::[0-9]{1,5})?))(?<![._-])(?:\/(?![._-])[a-z0-9._-]*(?<![._-]))*)(?:(?<tag>(?::(?![.-])[a-zA-Z0-9_.-]{1,128}))|(?<sha>@sha256:[0-9a-f]{64}))?$
/

Description

Named groups, port in registry, sha256

Submitted by petersamokhin with help from https://stackoverflow.com/questions/39671641 - 2 years ago