Last active
January 22, 2020 10:17
-
-
Save DamienGarrido/acaf7cc117bbe741e0fd166eaad7338b to your computer and use it in GitHub Desktop.
Docker image name regular expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat <<EOT | grep -nP '^(?:([a-zA-Z0-9.-]+(?:\.[a-zA-Z0-9-]+)+)(?::(\d+))?\/)?((?:[^/:\r\n]*\/)*?)([^/:\r\n]+)(?::([^/:\r\n]+))?$' | |
hostname.example.com:80/some/path-to/image_name-1.0:with_tag-1.0.0 | |
hostname.example.com/some/path-to/image_name-1.0:with_tag-1.0.0 | |
some/path-to/image_name-1.0:with_tag-1.0.0 | |
image_name-1.0:with_tag-1.0.0 | |
hostname.example.com:80/some/path-to/image_name-1.0 | |
hostname.example.com/some/path-to/image_name-1.0 | |
some/path-to/image_name-1.0 | |
image_name-1.0 | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment