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

NoRulez norulez at me.com
Fri Aug 26 21:58:33 CEST 2011


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>:

> 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
> 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/0f7e3327/attachment.html 


More information about the Qt-interest-old mailing list