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

Thiago Macieira thiago at kde.org
Fri Aug 26 22:07:22 CEST 2011


On Friday, 26 de August de 2011 19:53:08 Cole, Derek wrote:
> 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();

Regardless of whether the replacing works, which object manages the lifetime 
of that pointer?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110826/eba224d9/attachment.bin 


More information about the Qt-interest-old mailing list