I'm using the Mux package from the Golang Gorilla Toolkit for my routes.
Consider the following routes:
m.HandleFunc("/admin/install", installHandler).Methods("GET")
m.HandleFunc("/admin/^((?!install).)*$", adminHandler).Methods("GET")
m.HandleFunc("/admin", adminHandler).Methods("GET")
The problem is with the regex of the middle route - it is not interpreted, so the route will not work!
m.HandleFunc("/admin/{^((?!install).)*$}", adminHandler).Methods("GET")
With the {} curly brackets doesn't work either. It is just ignored, and treated as /admin/
Neither does:
m.HandleFunc("/admin/{_dummy:^((?!install).)*$}", adminHandler).Methods("GET")
In short, what I'm trying to achieve here is to first match the /admin/install route, and that exact route I then want to exclude from the route below, using the regex, but it doesn't work.
Is there some way to use regex with the gorilla mux package?
[paths] are defined using the format {name} or {name:pattern}
. gorillatoolkit.org/pkg/mux – JimB[^install]
is not the same as "not followed by the word install". – VonC