# Problem with {} in map regex matching

**URL:** <https://www.ruby-forum.com/t/problem-with-in-map-regex-matching/236885>\
**Category:** NGINX\
**Created:** [October 9, 2013, 1:05pm UTC](https://www.ruby-forum.com/t/problem-with-in-map-regex-matching/236885 "2013-10-09T13:05:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 9, 2013, 1:05pm UTC](https://www.ruby-forum.com/t/problem-with-in-map-regex-matching/236885/1 "2013-10-09T13:05:24Z")

</div>

To my surprise, apparently doing a match with {} like in:

map $args $has\_tr0\_arg {  
default 0;

~“tr%5B0%5D%3D=[1-9][[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}T[[:digit:]]{2}%2F[1-9][[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}T[[:digit:]]{2}%26”  
1;

~"%26tr%5B0%5D%3D=[1-9][[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}T[[:digit:]]{2}%2F[1-9][[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}T[[:digit:]]{2}"  
1;  
}

Doesn’t work.

Which is bit surprising knowing that location regex matching works with  
{},  
of course you have to quote it, like I do above.

This is what I get from nginx -t:

nginx: [emerg] unexpected “{” in /etc/nginx/nginx.conf

Is this expected behavior or I’m doing something wrong here?

Thanks,  
----appa

---

<div class="post-metadata">

**Author:** ![SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47774/32.png) [@SSAntS\_nio\_PSPSAlm](https://www.ruby-forum.com/u/SSAntS_nio_PSPSAlm)\
**Post date:** [October 9, 2013, 1:45pm UTC](https://www.ruby-forum.com/t/problem-with-in-map-regex-matching/236885/2 "2013-10-09T13:45:10Z")

</div>

Hello!

On Wed, Oct 09, 2013 at 01:04:46PM +0200, António P. P. Almeida wrote:

> }  
> Is this expected behavior or I’m doing something wrong here?  
> Leading ‘~’ is outside quotes, which results in your regular  
> expression being interpreted as non-quoted string. Use something  
> like this instead:

```
map ... {
    "~(foo){3}" 1;
}

```

–  
Maxim D.  
[http://nginx.org/en/donation.html](http://nginx.org/en/donation.html)
