nging pcre_compile error when using quantifiers

listed in answer

nging pcre_compile error when using quantifiers
0 votes, 0.00 avg. rating (0% score)

ANSWER:

It figures you’re starting the contents of the location block. It figures wrong.

Wrap it in quotes:

location ~ "^/i/gallery2/(d1,4)(.*)$" {

by Shane Madden from http://serverfault.com/questions/383217