nginx位置正则表达式,匹配多次

lov*_*ing 2 regex nginx

如何在nginx位置正则表达式中多次匹配?

似乎{x,x}语法永远不会有效!

例如:

location ~ ^/abc/\w{1,3}$ {
  ...
}
Run Code Online (Sandbox Code Playgroud)

神经工作!

Ale*_*Ten 6

您必须引用包含{;字符的位置.

location ~ "^/abc/\w{1,3}$" {
    ...
}
Run Code Online (Sandbox Code Playgroud)

否则nginx解析它location ~ ^/abc/\w { 1, ...并因语法错误而失败.