的內容我有一個字符串這樣<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