Regular expression length syntax not working?

Francis Daly francis at daoine.org
Thu Dec 11 08:12:25 UTC 2014


On Wed, Dec 10, 2014 at 09:51:11PM -0500, hyperion wrote:

Hi there,

>         location ~ ^/event/[0-9,A-Z]{16}/info$ {
>             proxy_pass http://localhost:7777;
>         }

> I don't get a match.


[root at monolith1 nginx]# sbin/nginx -t
nginx: [emerg] unknown directive "16}/info$" in /usr/local/nginx/conf/nginx.conf:32
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

I suspect that you also don't get the config file used at all.

> I have to manually repeat the [0-9,A-Z] sixteen times to get a match. 
> Escaping the {} doesn't work either, i.e. /[0-9,A-Z]\{16\}/info
> 
> How can I use the {} syntax correctly?

This page seems to describe the nginx regular expression syntax

http://nginx.org/en/docs/http/server_names.html#regex_names

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list