
心好累,写出来不是通不过 nginx 的检测就是没效果。
我想替换的内容里带有单引号',例如:'<img src=http'
我先这么尝试 subfilter '<img src=http' ''<img src=https'' //错误<
尝试改成正则 sub_filter '(.)img src=http' ''$1img src=https'’ r; //错误$
_(:з」∠) 不是支持正则么为啥$都错误了
1 rrfeng 2016-02-19 00:42:19 +08:00 知道单引号有问题为撒用正则屏蔽了 < …… |
2 rrfeng 2016-02-19 00:43:30 +08:00 哪里有单引号了…… |
3 xuhaoyangx 2016-02-19 00:46:12 +08:00 还有其他一些在后边章节中有特殊用处的标点符号,在前面加 "\" 后,就代表该符号本身。比如:^, $ 都有特殊意义,如果要想匹配字符串中 "^" 和 "$" 字符,则表达式就需要写成 "\^" 和 "\$"。 来自复制粘贴 |
4 fantasts OP |
6 demo 2016-02-19 09:45:58 +08:00 \' |
7 popok 2016-02-19 09:48:56 +08:00 |
8 xuhaoyangx 2016-02-19 11:36:32 +08:00 @popok 我知道转义 |
9 fantasts OP @popok 不知道咋整 例如: sub_filter '<div.*<div.*<iframe.*</iframe></div><div class="content">' '<div class="content">' r; 报错: nginx: [emerg] invalid number of arguments in "sub_filter" directive in 如何才能正确的使用正则而不报错呢。。。 |
10 fantasts OP |
11 xuhaoyangx 2016-02-19 17:55:26 +08:00 @fantasts 那需要自己 add module |
12 jalena 2016-02-19 19:7:08 +08:00 用转义符转义啊 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
13 liuyinltemp 2018-05-09 13:18:58 +08:00 @fantasts 这个正则怎么写? |