我想更换更换匹配不区分大小写的假设组合:正则表达式与匹配+插件
text St<font color="red">miX</font>x and some more <font color="red>mIx</font> text
代码:
$string = "text StmiXx and some more mIxx text";
$pattern = "/mix/i";
$replacement = "<font color=\"red\">match</font>";
echo preg_replace($pattern, $replacement, $string);
如何
text StmiXx and some more mIxx text
正则表达式替换后这可以用正则表达式来完成吗?我也想用(Linux)sed试试这个,或者还有egrep,grep的方法。
egrep有一个选项--color = always但不是自定义高亮。
不客气。如果我的答案解决了您的问题,请随时通过点击答案左侧的投票计数下方的空白勾号图标来接受此问题。 – Shef