Regular expression in nginx

I am trying to match / category / anything except / category / paid in nginx place.

I have the following regular expression, but it does not work. Google tells me that I can use lookahead in nginx. Am I doing something wrong?

location ^/category(?!/paid)/ { } 
+7
regex nginx lookahead
source share
1 answer

You either need a slash in front of it, or a hidden slash.

 location ~ (category/(?!paid)) { .. } location ~ (category\/(?!paid)) { .. } 
+5
source share

All Articles