[Qt-interest] QRexExp to find file in a string

Cole, Derek dcole at integrity-apps.com
Fri Aug 26 22:03:49 CEST 2011


I think I have tried that before as well. With that, I get

"/home/dirs/somefilenewstuff.abc"
________________________________
From: NoRulez [norulez at me.com]
Sent: Friday, August 26, 2011 3:58 PM
To: Cole, Derek; Qt Interest MailingList
Subject: Re: [Qt-interest] QRexExp to find file in a string

Try it with the following expression:

"\\w+\\.txt$"

Best Regards
NoRulez

Am 26.08.2011 um 21:53 schrieb "Cole, Derek" <dcole at integrity-apps.com<mailto:dcole at integrity-apps.com>>:

I have a string like

/home/dirs/somefile.txt

I want to use QRegExp to remove "somefile.txt" and replace it with "newstuff.abc"

   QRegExp rx("/w*\\.txt$");

    const char *DstFilename = newfile.replace(rx,"newstuff.abc").toStdString().c_str();

The above doesnt seem to work. Can someoen tell me whats wrong? Thanks
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com<mailto:Qt-interest at qt.nokia.com>
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110826/9b20f0db/attachment.html 


More information about the Qt-interest-old mailing list