› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
wdssmq
V2EX  ›  NGINX

Nginx 配置中,正则中的 \d{10} 语法会报错,目测是花括号被识别为了语法块?

  •  
  •   wdssmq ·
    wdssmq · Jul 13, 2024 · 3155 views
    This topic created in 849 days ago, the information mentioned may be changed or developed.

    nginx version: nginx/1.24.0

    4 replies  •  2024-07-14 17:47:45 +08:00
    JFZ
    JFZ
    Jul 13, 2024
    1
    同样遇到
    itechify
    itechify
    Jul 13, 2024
    2
    双括号包一下试试?
    ltux
    ltux
    Jul 14, 2024 via Android❤️1
    3
    含有大括号的正则表达式需要用双引号引起来。

    A regular expression containing the characters “{” and “}” should be quoted:

    server_name "~^(?<name>\w\d{1,3}+)\.example\.net$";
    wdssmq
    wdssmq
    OP
    Jul 14, 2024
    4
    @oneisall8955
    @ltux

    可以了,,感谢。。

    结果 AI 也没能告诉我这个答案。。- -
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1093 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:01 · PVG 07:01 · LAX 15:01 · JFK 18:01
    ♥ Do have faith in what you're doing.