[SOLVED] QString find all occurrences by RegExp

  • Hi, devnet.

    I have a task to find all occurrences in QString with RegExp and pack them into QStringList.

    My current implementation of this problem is ugly and not Qt-way. I've also read documentation. There are nothing connected with it.

    I want to do it like this:
    QString text = object->getString(RANGE_ALL);
    QString regexp = object->getRegExp();

    QStringList occur = text.findAllOccurrences(regexp);

    I know that this code is wrong because QString does not have method findAllOccurrences(QRegExp&) but how can I do it in Qt-way.

    Thanks in advance.

  • I think that QRegExp::capturedTexts () can help in this case

  • Thanks, tass. It should be that I was finding!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.