This is probably me doing something wrong, as I'm new to go and chi, but any help would be really appreciated!
I am serving a URL in the form /test/f9772163-44e7-49b1-9c8c-36b8d023aa6b-2024-01-01 which is a UUID and date, separated by a -.
I hoped I could match this using a regex pattern in the router pattern string, but this fails to match.
r.Get("/test/{UUID:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}}-{date}", func(w http.ResponseWriter, r *http.Request) {
uuidParam := chi.URLParam(r, "UUID")
dateParam := chi.URLParam(r, "date")
w.Write([]byte(uuidParam + "\n" + dateParam))
})
Expected:
f9772163-44e7-49b1-9c8c-36b8d023aa6b
2024-01-01
Actual:
This is probably me doing something wrong, as I'm new to go and chi, but any help would be really appreciated!
I am serving a URL in the form
/test/f9772163-44e7-49b1-9c8c-36b8d023aa6b-2024-01-01which is a UUID and date, separated by a-.I hoped I could match this using a regex pattern in the router pattern string, but this fails to match.
Expected:
Actual: