Skip to content

Instantly share code, notes, and snippets.

@RJ
Last active December 16, 2024 15:00
Show Gist options
  • Save RJ/fe728f939cdf1227457100fd6185e221 to your computer and use it in GitHub Desktop.
Save RJ/fe728f939cdf1227457100fd6185e221 to your computer and use it in GitHub Desktop.
edgegap container image path regex bug
```
^(?:(?=[^:\\/]{4,253}) # Optional registry (non-capturing group)
(?!-) # Ensure no leading dash
[a-zA-Z0-9-]{1,63} # Allow alphanumeric and dashes (max 63 chars)
(?<!-) # Ensure no trailing dash
(?:\\.(?!-) # Allow dot-separated components, no dash after dot
[a-zA-Z0-9-]{1,63} # Same 63-char alphanumeric and dash rules
(?<!-))* # Zero or more of these subcomponents
(?::[0-9]{1,5})? # Optional port (e.g., :5000)
/)? # End of optional registry
((?![._-]) # Start repository (capturing group 1)
(?:[a-z0-9._-]*) # Allow alphanumeric, dot, underscore, dash (optional)
(?<![._-]) # Ensure no trailing . _ or -
(?:/(?![._-]) # Sub-paths separated by /, no leading . _ -
[a-z0-9._-]*(?<![._-]) # Same rules for sub-paths
)*) # Zero or more sub-paths
(?::(?![.-]) # Optional tag (capturing group 2)
[a-zA-Z0-9_.-]{1,128} # Alphanumeric, dot, underscore, dash (1–128 chars)
/?$ # Ensure proper path termination
```
**Line 13 and 16 should allow capital letters too**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment