<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I detected an issue with my rewrite rule in the nginx.conf and I don't understand why it happens and how to fix it.</div><div><br></div><div>I have tested in two environments with versions 1.10.3 and 1.14.0.</div><div><br></div><div>Having the following simple conf with a regex is intended to get everything:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">location /foo {<br><span style="white-space:pre-wrap">  </span>rewrite /foo/(.*) /web/foo.do?a=$1 last;<br>}</blockquote></div><div><br></div><div>OK:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf" target="_blank">https://www.test.com/foo/asdf</a> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf-asdf" target="_blank">https://www.test.com/foo/asdf-asdf</a> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf12" target="_blank">https://www.test.com/foo/asdf12</a> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf12-asdf" target="_blank">https://www.test.com/foo/asdf12-asdf</a></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/12" target="_blank">https://www.test.com/foo/12</a></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/-12" target="_blank">https://www.test.com/foo/-12</a></blockquote><div><div><br></div><div>KO:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf-12" target="_blank">https://www.test.com/foo/asdf-12</a> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.test.com/foo/asdf-12-asdf" target="_blank">https://www.test.com/foo/asdf-12-asdf</a></blockquote></div><div><div><br></div><div>As implementing <span class="m_9119623107901279272m_5914201835362389046gmail-gr_ m_9119623107901279272m_5914201835362389046gmail-gr_459 m_9119623107901279272m_5914201835362389046gmail-gr-alert m_9119623107901279272m_5914201835362389046gmail-gr_spell m_9119623107901279272m_5914201835362389046gmail-gr_inline_cards m_9119623107901279272m_5914201835362389046gmail-gr_run_anim m_9119623107901279272m_5914201835362389046gmail-ContextualSpelling m_9119623107901279272m_5914201835362389046gmail-ins-del m_9119623107901279272m_5914201835362389046gmail-multiReplace" id="m_9119623107901279272m_5914201835362389046gmail-459" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat">pcre</span> regex, this regex works in all cases in the common regex online sites but not in <span class="m_9119623107901279272m_5914201835362389046gmail-gr_ m_9119623107901279272m_5914201835362389046gmail-gr_589 m_9119623107901279272m_5914201835362389046gmail-gr-alert m_9119623107901279272m_5914201835362389046gmail-gr_spell m_9119623107901279272m_5914201835362389046gmail-gr_inline_cards m_9119623107901279272m_5914201835362389046gmail-gr_run_anim m_9119623107901279272m_5914201835362389046gmail-ContextualSpelling" id="m_9119623107901279272m_5914201835362389046gmail-589" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat">nginx</span>.</div><div><br></div><div>Why if I put a number after a hyphen the regex stops working?</div><div><br></div><div>Many thanks,</div><div><br></div>-- <br><div dir="ltr" class="m_9119623107901279272m_5914201835362389046gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Ivan Bianchi</div><div>Wikiloc</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>