Regular Expressions - Ask a question about regular expression replacement in nginx
某草草
某草草 2017-05-16 17:09:29
0
1
865

I plan to use nginx's subs_filter to replace certain links or strings, but nginx's regular rules seem to be a little different from those of python and the like. . Here are the tried matches

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       
}

Can you please elaborate? grateful

某草草
某草草

reply all(1)
我想大声告诉你

subs_filter https://(.*).wikipedia.org http://wiki.example.org ir;
i表示忽略大小写
r means the preceding one is regular

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template