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

NoRulez norulez at me.com
Fri Aug 26 22:08:16 CEST 2011


You have forgotten the double backslash before the "w*"

You could also try "rx.setMinimal(true);"

Am 26.08.2011 um 22:03 schrieb "Cole, Derek" <dcole at integrity-apps.com>:

> 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>:
> 
>> 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/81315b4a/attachment.html 


More information about the Qt-interest-old mailing list