slava
12th July 2010, 16:32
Hello! I'm trying to figure out regexp for a line that contains starts in itself. For example some of the lines may start with ***HELLO and then continue with something else where stars are the actual stars symbols:
!HELLO - This is the first line
(HELLO) - Thi is is the second line
***HELLO - is the third line
HELLO - This is the fourth line
etc.
In this text I need to locate line # 3. How can I do it with the regexp? I have tried:
QRegExp rx("***HELLO*");
rx.setPatternSyntax(QRegExp::Wildcard);
statLineIndex = statFile.indexOf(rx);
QMessageBox::about(0, "test", QString::number(statLineIndex));
but, of course I keep getting first and second line and can't deffirentiate the starts, first three mean the actual star symbols and the last one is any characters. How do I diffirentiate those?
!HELLO - This is the first line
(HELLO) - Thi is is the second line
***HELLO - is the third line
HELLO - This is the fourth line
etc.
In this text I need to locate line # 3. How can I do it with the regexp? I have tried:
QRegExp rx("***HELLO*");
rx.setPatternSyntax(QRegExp::Wildcard);
statLineIndex = statFile.indexOf(rx);
QMessageBox::about(0, "test", QString::number(statLineIndex));
but, of course I keep getting first and second line and can't deffirentiate the starts, first three mean the actual star symbols and the last one is any characters. How do I diffirentiate those?