PCRE with NGINX

Hi,

I am trying to insert a PCRE inside a map block. But looks like “{” used
in
my code is not liked.

Suppose I am doing something like this inside a “map” block.

.{1}(?P<string>.{9}).*

What is the escape character for "{ "

Please let me know.

Thanks…

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258636#msg-258636

{
Would do it.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258637#msg-258637

I tried that alrwady . I don’t get errors. But, the functionality does
not
work. So, I am not sure if the PCRE is not liking it or something
else…Still debugging.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258638#msg-258638

This works:
~{.:; 1;
with map, do note that a 400 in logging means something else which
precedes
map handling.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258644#msg-258644

Thanks for the explanation.
Sorry, not able to understand you fully.
My PCRE is something like this (have tested it through
https://regex101.com/)

.+…{3}(?P.{6})[^.]*$

Now, to achieve this what should I put in the nginx.conf

Please let me know.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258646#msg-258646

I looked @ http://nginx.org/en/docs/http/server_names.html
It sames put it inside " " and once I did that it is working
Thank you.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,258636,258649#msg-258649

On Tue, May 05, 2015 at 04:50:28AM -0400, nginxsantos wrote:

Hi there,

I looked @ http://nginx.org/en/docs/http/server_names.html
It sames put it inside " " and once I did that it is working

Yes - “wrap the regex in double quotes” is the right answer.

This line does appear in the documentation for “rewrite” and for “if”;
but not for “location” or “map”.

nginx documentation improvement suggestion:

It may be worth adding it to those (and anywhere else that uses
regexes);
or to link from everywhere to a “regex in nginx” document.

(Yes, I know “patches welcome”, and I’m not providing any. I’m not sure
whether “duplicate” or “link” is better.)

Thanks,

f

Francis D. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs