问个正则表达式,怎么排除
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><?php $str = 'img我b有110www<br>有110110好呀'; echo preg_replace('/(img|110|b)/i', "<b>\${1}</b>", $str); ?>
'/(?<!<)(img|110|b)/i' <br /><font color='#e78608'>------解决方案--------------------</font><br />如果你需要考虑复杂点的情况,正则式就稍微复杂点,注意标签html标签内的img,110,b<br /><dl class='code'>PHP code<pre class="brush:php;toolbar:false"> $str = '<img src="img/110/b.jpg"/>我img我b有110www<br>有110110好呀'; echo preg_replace('#(?=[^>]*(?=<|$))(img|110|b)#is','<b>\1</b>',$str); <div class="clear"> </div>