使用字符串替换的 nginx url 重写

ngw*_*ngw 4 rewrite nginx

我需要知道我的 url 是否包含一个小的 substr,保持 url 原样并只重写那一小部分,我该如何完成?

例如:

http://foobar.com/foo-bar-substrtocatch-baz 
Run Code Online (Sandbox Code Playgroud)

应该成为

http://foobar.com/foo-bar-changedsubstr-baz
Run Code Online (Sandbox Code Playgroud)

提前致谢...

cns*_*nst 7

rewrite    ^(.*)substrtocatch(.*)$    $1changedsubstr$2;
Run Code Online (Sandbox Code Playgroud)