Results 1 to 6 of 6

Thread: I've found but how to use

  1. #1
    Join Date
    Aug 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default I've found but how to use

    The regular expression I've found by the position it starts can be any length long.
    What is the convinient way to get it all into a string? It's starting position in the mother string is not enough knowlege, you see.

    I.m working with QFile QTextStream QRegExp objects.
    Probably another tech should be used or can you open my eyes on methods I've missed?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: I've found but how to use

    J-P Nurmi

  3. #3
    Join Date
    Aug 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I've found but how to use

    Thank you JPN. It helps:
    see regexp1.png

    Now experiencing problems while splitting the founded expression(number1 / number2 into QStringList "number1" , "number2" ) using Qstring str.split(" \ / ") code line:
    see regexp10.png.

    Probably, I' ve made a mistake, but
    I can not retrieve correct results from help code example also:
    http://doc.trolltech.com/4.4/qregexp.html#capturedTexts :
    see regexp2.png

    How can it be possible to cut founded end extracted( thks to JPN) regular expression into
    QStringList by

    Qstring str.split(..)

    or

    Qregexp rx;
    QStringList rx.capturedTexts();

    or any other way?
    Attached Images Attached Images

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: I've found but how to use

    that code works
    Qt Code:
    1. qDebug() << QString("number1 / number2").split(" / "); //("number1", "number2")
    To copy to clipboard, switch view to plain text mode 
    or I didn't understand something?

  5. #5
    Join Date
    Aug 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I've found but how to use

    You are right. It works. I couldn't see it becouse hadn't iterated through returned QStringList object properly.

    You Returned it to... QDebug(). What is it and waht you could see then ?

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: I've found but how to use

    the result of this code is
    ("number1", "number2")
    in your case
    Qt Code:
    1. QStringList result = QString("number1 / number2").split(" / ");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Visual Studio 2005 Express
    By Muzz in forum Installation and Deployment
    Replies: 22
    Last Post: 6th November 2008, 06:21
  2. qt4.4.0 using windows, moc.exe not found
    By graubrust in forum Installation and Deployment
    Replies: 2
    Last Post: 9th July 2008, 09:35
  3. Program crashes with assert error in xcb_lock.c
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 19:56
  4. KDE 3.5.0 crash while opening project
    By MarkoSan in forum KDE Forum
    Replies: 2
    Last Post: 19th October 2007, 16:21
  5. Qt 4.3.0 lots of Bugs!
    By VireX in forum Qt Programming
    Replies: 69
    Last Post: 20th June 2007, 22:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.