did you look at Qt Assistant, there is an example in QRegExp::search?
Qt Code:
  1. QString str = "offsets: 1.23 .50 71.00 6.00";
  2. QRegExp rx( "\\d*\\.\\d+" ); // primitive floating point matching
  3. int count = 0;
  4. int pos = 0;
  5. while ( (pos = rx.search(str, pos)) != -1 ) {
  6. count++;
  7. pos += rx.matchedLength();
  8. }
  9. // 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