[SOLVED] QRegExp Help



  • So I have a string that has /* comments in it. and I want to strip then all out using QRegExp here is what I tried.

    @
    QString buff = "this is just a test /* testing comment / some more text\n/ another \n test / and more";
    QRegExp regx("/*.
    ?*/");
    qDebug() << regx.indexIn(buff, 0);
    @

    but qDebug() allways gets a -1 from regx telling me it's never found :( no idea why, I also tried some other patterns as follows.

    @
    QRegExp regx("/\.?\/");
    QRegExp regx("\/\
    .?\\/");
    @

    Nothing seems to work.



  • The "?" modifier for non-greedy matching is not supported in QRegExp. Use setMinimal(true).



  • Aww that was it! thanks :D <3


Log in to reply
 

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