Please nominate your Qt Champions for 2021!

Help in constructing a QRegExp

  • I want to remove ".bmp" from my file name using QRegExp. My file name is formatted as "Alphanumerics.bmp".
    Could someone help me with constructing QRegExp for this?

    How can I use QRegExp for removing a part of QSting ?


  • Moderators

    QString mystring("alphanumerics.bmp");

    mystring.replace(".bmp", "");

    Done :) No need for regexp here. Alternatively, you can get the extension using QFileInfo::suffix().

Log in to reply