I'm trying to get a param(h=1500 for example) via regex in a server block in an nginx server but it's not working. My last try was this:
location ~ "^/app/events/(?<eventid>\d+)/(?<image>.+)?h=(?<height>\d+)$" { ...... }
Here you can check and it works: https://regex101.com/r/kP9eY9/1
But in my server block file it does't.
If I try something like this, it works:
location ~ "^/app/events/(?<eventid>\d+)/(?<image>.+)/(?<height>\d+)$" { ...... }
Instead a param like "h=300", I just use a "/300" and I can get the value in my server block file.
I'm not a expert using regex so I can't see if there is something wrong. I need your help guys! Thank you!
h\=. Also?after your(?<image>.+). First request has it, but second doesn't. According to example string in provided link, I guess you wanted to set it as a character, not as special symbol, so use(?<image>.+)\?(?<image>.+)\?but this also doesn't work. And yes, I want it as a character like a get parameter?foo=bar. I don't know if I did undertand, do I also need to escape the eqiality sign? Like\?h\=(?<height>\d+)