Results 1 to 3 of 3

Thread: QRegExp parsing matched quoted strings

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Apr 2009
    Location
    Italy
    Posts
    70
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    23
    Thanked 15 Times in 11 Posts

    Post Re: QRegExp parsing matched quoted strings

    The following pattern works for me with the input you provide and a few more I tested:

    Qt Code:
    1. test(
    2. "test \"a string\" \"string \\\" escaped\" 1 2",
    3. "((?:[^\\s\"]+)|(?:\"(?:\\\\\"|[^\"])*\"))");
    To copy to clipboard, switch view to plain text mode 

    Output of qDebug() << rx.cap(1):

    testing "test "a string" "string \" escaped" 1 2" against "((?:[^\s"]+)|(?:"(?:\\"|[^"])*"))"
    "test"
    ""a string""
    ""string \" escaped""
    "1"
    "2"

  2. The following user says thank you to mattc for this useful post:

    jhndnn (26th January 2010)

Similar Threads

  1. Unicode strings int Qt 4.2.1
    By mkrentovskiy in forum Qt Programming
    Replies: 12
    Last Post: 29th December 2011, 09:02
  2. Replies: 1
    Last Post: 21st September 2009, 07:30
  3. Linguist and static strings
    By Equilibrium in forum Qt Tools
    Replies: 7
    Last Post: 5th March 2008, 13:08
  4. Adding strings in QTreeWidget ?
    By npc in forum Newbie
    Replies: 13
    Last Post: 30th January 2007, 09:24
  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.