PHPだと
$keyword = preg_replace("/(\<.*?\>|\(.*?\))/", "\"$1\"", $keyword, -1, $count); if($count == 0) { $keyword = preg_replace("/(\<|\>|\(|\)|\+|\-|\*|\~)/", "\\$1", $keyword); }
こんな感じでしょうか?
PHPだと
$keyword = preg_replace("/(\<.*?\>|\(.*?\))/", "\"$1\"", $keyword, -1, $count); if($count == 0) { $keyword = preg_replace("/(\<|\>|\(|\)|\+|\-|\*|\~)/", "\\$1", $keyword); }
こんな感じでしょうか?