Results 1 to 2 of 2

Thread: Simple RegExp Question...

  1. #1
    Join Date
    Jun 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Simple RegExp Question...

    Hey, I know this is a newbie question, and that's what I am.. but if I want to detect a double quote, I'm trying..

    QRegExp rx("\\"");

    which doesn't work... so what's the proper syntax for quotes in Qt? In PHP, Python that would be fine - except I'd only need one \ for the escape, two here.. but clearly I'm doing something wrong... any pointers?

  2. #2
    Join Date
    Jul 2008
    Posts
    24
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Simple RegExp Question...

    Quote Originally Posted by jared.carlson23 View Post
    QRegExp rx("\\"");
    Your second \ is escaped by the first one, which means the C compiler ends the string right after it and starts a new one. This example does not even compile. The correct syntax would be:
    Qt Code:
    1. QRegExp rx("\\\"");
    To copy to clipboard, switch view to plain text mode 

    Here both the second \ and " are escaped, so the string that is passed to the constructor is \", which is what you expect.

Similar Threads

  1. a simple noob question
    By wrproject in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 23:25
  2. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  3. Quick RegExp question
    By stealth86 in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2007, 08:23
  4. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02
  5. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

Tags for this Thread

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.