【发布时间】:2014-03-31 17:32:17
【问题描述】:
以下将任何 IP 地址替换为 <ip>。
$match = '/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/';
$replace = '<ip>';
$CurrentText = preg_replace($match, $replace, $CurrentText);
如何只替换不以 192 或 10 开头的 IP 地址。
即。 10.0.0.1 不应该匹配,但 11.0.0.1 应该匹配。
【问题讨论】: