You have to double escape the \ . It looks very nasty but it must be done:
Qt Code:
  1. QString s = "(123) (333s) (2)";
  2. QRegExp rx("\\(([0-9]+)\\)");
  3. int pos = 0;
  4. while ((pos = rx.indexIn(s, pos)) != -1) {
  5. qWarning() << rx.cap(1);
  6. pos += rx.matchedLength();
  7. }
To copy to clipboard, switch view to plain text mode