Here's an example from the docs:
QString str
= "offsets: 1.23 .50 71.00 6.00";
QRegExp rx
( "\\d*\\.\\d+" );
// primitive floating point matching int count = 0;
int pos = 0;
while ( (pos = rx.search(str, pos)) != -1 ) {
count++;
pos += rx.matchedLength();
}
// pos will be 9, 14, 18 and finally 24; count will end up as 4
QString str = "offsets: 1.23 .50 71.00 6.00";
QRegExp rx( "\\d*\\.\\d+" ); // primitive floating point matching
int count = 0;
int pos = 0;
while ( (pos = rx.search(str, pos)) != -1 ) {
count++;
pos += rx.matchedLength();
}
// pos will be 9, 14, 18 and finally 24; count will end up as 4
To copy to clipboard, switch view to plain text mode
You need something similar. QRegExp::cap( 0 ) should return the whole matched tag.
Bookmarks