Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
^ (?P<name> (?:(?P<domain>(?:(?:localhost|[\w-]+(?:\.[\w-]+)+)(?::\d+)?)|[\w]+:\d+)/)? (?P<image>[a-z0-9_.-]+(?:/[a-z0-9_.-]+)*) ) (?::(?P<tag>[\w][\w.-]{0,127}))? (?:@(?P<digest>[A-Za-z][A-Za-z0-9]*(?:[+.-_][A-Za-z][A-Za-z0-9]*)*:[0-9a-fA-F]{32,}))? $
"
gxim

Description

Put together from information in: https://github.com/docker/distribution/blob/master/reference/reference.go (see comment at the beginning of the file) and https://github.com/docker/distribution/blob/master/reference/normalize.go (see func splitDockerDomain)

Submitted by Leonhard Wimmer - 6 years ago