What is the correct way to regex route parameters in Genie.jl?

I’m trying to use a regex for one of the fields in a web app’s route. The route requires a lot of dynamic routing. My issue resides in the fact that the regex field is not the last field in my route, and I realized that there is where the problem arises

I am using

route("/field1/:field2#regex/:field3") do

Specifically the regex I’m using if it helps is .+:[0-9]+ since I need to interpret addresses in the form host:port, which gives Genie trouble due to the presence of colon in the route parameter.

I noticed, however, that the router seems to interpet the regex to be .+:[0-9]+/:field3 as opposed to simply .+:[0-9]+ with :field3 as a different dynamic parameter which is what I want.

What would be the correct way to use a dynamic regex field in my route and then continue using dynamic routing? Or, as an alternative solution, is there a different way to tell Genie to accept a dynamic route parameter with a colon in it?

Thanks a lot

1 Like