I want clean any comments in my source code. I tried like this. But I think not work properly 
QRegExp ex
("//[^\n]*");
//single line comment
QFile f
("/home/wirasto/coba.php");
if (f.
open(QIODevice::ReadOnly|QIODevice
::Text)) { while (!in.atEnd()) {
qDebug() << str.replace(ex, "");
}
}
QRegExp ex("//[^\n]*"); //single line comment
QFile f("/home/wirasto/coba.php");
if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
QTextStream in(&f);
while (!in.atEnd()) {
QString str=in.readLine();
qDebug() << str.replace(ex, "");
}
}
To copy to clipboard, switch view to plain text mode
And I think for multiline comments will be more difficult 
I already found this thread.
Bookmarks