正規表示式 - 請教個nginx正規替換的問題
某草草
某草草 2017-05-16 17:09:29
0
1
788

本人打算使用nginx的subs_filter進行某些連結或字串的替換,但nginx的正則似乎和python之類的正則有點出入。 。下面是試過的配對

location / { #目的是将https://*.wikipedia.org替换成http://wiki.example.org subs_filter .wikipedia.org .wiki.example.org;#这个只能替换成https://wiki.example.org #也尝试过 subs_filter https://zh.wikipedia.org http://zh.wiki.example.org 但不行,会变成https://zhhttp://example.org }

請問可否詳細說說?感謝

某草草
某草草

全部回覆 (1)
我想大声告诉你

subs_filter https://(.*).wikipedia.org http://wiki.example.org ir;
i表示忽略大小写
r表示前面是正規

    最新下載
    更多>
    網站特效
    網站源碼
    網站素材
    前端模板
    關於我們 免責聲明 Sitemap
    PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!