Hi,
I am trying to write a regexp for syntax highlighter to capture only numbers in a text like [12]. So I need to find a number in brackets but I don't need brackets to be captured. Any suggestions?
Hi,
I am trying to write a regexp for syntax highlighter to capture only numbers in a text like [12]. So I need to find a number in brackets but I don't need brackets to be captured. Any suggestions?
This should work :
Qt Code:
qDebug() << str; int pos= 0; while( (pos = regExp.indexIn(str, pos)) != -1) { qDebug() << "Found " << regExp.cap(1); pos += regExp.matchedLength(); }To copy to clipboard, switch view to plain text mode
Tnx, I just hoped that that could be done without cap.
Bookmarks