的内容我有一个字符串这样<script>||| [CA]this is my content<br> ABC**&&PPPP[/CA]Just Some Random Text<span>[CA]this is my content2<br> 123**''&&PPPP[/CA]
我有这样的/\[CA\](.*)\[\/CA\]/
上面的字符串正则表达式我已经尝试了PHP的preg_replace()
得到输出文本之外[CA] [/CA]
标签应该是这样的:的preg_replace不更换串
<script>||| Just Some Random Text<span>
但我这里无法获得所需要的结果是我的全码:
<?php
$content = "<script>||| [CA]this is my content<br> ABC**&&PPPP[/CA]Just Some Random Text<span>[CA]this is my content2<br> 123**''&&PPPP[/CA]";
$CApattern = "/\[CA\](.*)\[\/CA\]/";
$content = preg_replace($CApattern,"", $content, -1,$count);
echo $content;
?>
是有什么问题正则表达式?
你确定你看'echo'ing后的HTML _source_?你意识到那些''标签将阻止你的浏览器显示输出结果?我看不到你还有什么“没有”。 – 2013-04-30 21:37:10