Results 1 to 6 of 6

Thread: Problem with QRegExp/C++

  1. #1
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem with QRegExp/C++

    Hello,
    I found here an example with boost regular expression ( http://shootout.alioth.debian.org/u3...&lang=gpp&id=3 )

    Perl example: http://shootout.alioth.debian.org/u3...ang=perl&box=1
    Python example: http://shootout.alioth.debian.org/u3...g=python&box=1

    Input file ( http://shootout.alioth.debian.org/do...xdna-input.txt ) and output file ( http://shootout.alioth.debian.org/do...dna-output.txt )

    I am new in Qt and C++ and very interesting how it would be looks like with QRegExp and is it possible to do write it shorter?

    Best reagards,
    Last edited by rte; 4th September 2009 at 23:52.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QRegExp

    QRegExp supports the perl syntax of regular expressions so the expression will be similar.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with QRegExp/C++

    Thank you for the link.

    Is it possible to use Qt e.g. QTextStream to simplify this program ( http://shootout.alioth.debian.org/u3...&lang=gpp&id=3 ), because it is very long.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with QRegExp/C++

    Quote Originally Posted by rte View Post
    Is it possible to use Qt e.g. QTextStream to simplify this program ( http://shootout.alioth.debian.org/u3...&lang=gpp&id=3 ), because it is very long.
    You don't have to implement the rope, that's for sure. You can open the QTextStream on a string or a byte array but you can use the string or byte array directly too. QTextStream won't give you any benefit here.

    BTW. The thread title is still undescriptive. You don't really have a problem with QRegExp. You just need help with "Converting a regexp program from Perl or Python to Qt/C++" or something like that. Although I'm not sure what your actual problem is. Is it a school assignment? Or are you trying to prove some point (and what point?) to someone?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with QRegExp/C++

    This is not a school assignment I only find this example in internet. I am looking a way to rewrite this code in oder to get it shorter, because in Python or Perl is it possible to solve this problem in only few lines. I would like to learn how is the best and shortest way to work with files similar to Python and Perl.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with QRegExp/C++

    I don't think this problem is oriented on working with files, it's about regular expressions. For file access see QFile.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Expression in QRegExp
    By lyucs in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2009, 13:53
  2. QRegExp Help
    By Ahmad in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2007, 00:13
  3. QRegExp?
    By Marco812 in forum Qt Programming
    Replies: 3
    Last Post: 4th August 2006, 08:31
  4. need help for my QRegExp
    By patcito in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2006, 16:29
  5. Trouble parsing using simple QRegExp
    By johnny_sparx in forum Qt Programming
    Replies: 4
    Last Post: 24th February 2006, 00:42

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
  •  
Qt is a trademark of The Qt Company.