[Solved] Qt regexp
moravas last edited by
I have a little bit problem with using of QRegExp class. Please consider the following dummy example:
QString str = "sadsfsdfg52151";
r.indexIn(str); qDebug() << r.cap(0); qDebug() << r.cap(1); qDebug() << r.cap(2);
I hope that those find full string via "cap(0)", the first part of "str" via "cap(1)" and the numbers at end of the string via "cap(2)", but it doesn't print anything. What I made wrong? :(
Can anybody help me, how to write a properly regexp's with Qt?
JohanSolo last edited by JohanSolo
Your syntax is wrong, the QRegExp should read:
Note that the second 'z' is not written in caps any more.
Disclaimer: tested with Perl only.
You can also use: