I이 몇 가지 태그가 들어 MySQL의 $ 주석 텍스트 :
echo $comments;
//result is this
#John# Have a birthday <2.22.2013> [14-00] party /Club/ *Victoria*?
을
는 내가 PHP 코드가 모든 태그를 표시하고 다음과 같이 텍스트를 포함하지해야합니다
Have a birthday party ?
내가 사용이 코드 그러나 HIDDEN JUST의 텍스트는 []와 내가 다른 태그 TOO <를 텍스트를 숨길 BETWEEN CONTAINS > // ## $$ **()
function replaceTags($startPoint, $endPoint, $newText, $source) {
return preg_replace('#('.preg_quote($startPoint).')(.*)('.preg_quote($endPoint).')#si', '$1'.$newText.'$3', $source);
}
$source= $comments;
$startPoint='[';
$endPoint=']';
$newText='';
echo replaceTags($startPoint, $endPoint, $newText, $source);
여기서 무엇을 변경해야합니까? 감사
당신은 불필요한 부분 제거하는 정규식을 사용할 수 있습니다
[지금까지 해본 것은 무엇입니까?] (http://whathaveyoutried.com) – Joey
"태그"에 대한 정의는 무엇입니까? – deceze
<> // ** ## $$ [] %% – Vitalie