Map using regular expresion limited to {2} chars
Frank Ruske
F.Ruske at flyeralarm.de
Fri Sep 14 09:21:06 UTC 2012
Hello
I have a map to match my clients but somehow i can not limit the chars within the regular expression.
What i want to archive is the following map with a general regular expression:
map $uri $myclient {
default noclient;
~/de/? de;
~/es/? es;
~/nl/? nl;
# 1..n (always 2 chars long)
}
But when i try it this way:
map $uri $myclient {
default noclient;
~/(?<suffix>[a-z]{2})/ $suffix;
}
i get the following error:
nginx: [emerg] invalid number of the map parameters www.vm:17
This one works but i get even hits if i have more then 2 chars what is not desired behaviour.
map $uri $myclient {
default noclient;
~/(?<suffix>[a-z])/ $suffix;
}
Any ideas? Thank you!
Regards Frank
More information about the nginx
mailing list