Это удаляет блоки комментариев:
preg_replace('%/\*\s+comment\s+.*?\*/%s', '', $string)
И это также избавляет от устаревших пробелов:
preg_replace('%/\s*\*\s+comment\s+.*?\*/\s*%s', '', $string)
Вот тестовый скрипт:
#!/usr/bin/php
<?php
$string = <<<EOS
/* comment [comment goes here] */
/* comment please do not delete the lines below */
[I am a special line so I should not be changed ]
/* comment please do not delete the line above */
EOS;
print $string;
print "\n---\n";
print preg_replace('%/\*\s+comment\s+.*?\*/%s', '', $string);
print "\n---\n";
print preg_replace('%/\s*\*\s+comment\s+.*?\*/\s*%s', '', $string);
?>
Вывод с PHP 5.3.4:
/* comment [comment goes here] */
/* comment please do not delete the lines below */
[I am a special line so I should not be changed ]
/* comment please do not delete the line above */
---
[I am a special line so I should not be changed ]
---
[I am a special line so I should not be changed ]