Results 1 to 4 of 4

Thread: QRegExp for matching string between quotes with escaped quotes

  1. #1

    Default QRegExp for matching string between quotes with escaped quotes

    I tried to find a QRegExp expression for matching text between quotes with escaped quotes inside, but i couldn't find one. Also, I am a newbie and I can't really figure this out by my own. Any help would be appreciated. Thanks!

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

    Default Re: QRegExp for matching string between quotes with escaped quotes

    If you can't find a working regular expression then solve your problem without a regular expression.
    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
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QRegExp for matching string between quotes with escaped quotes

    You can find possible partial solutions here under the heading "Strings". Regular expression matching of balanced delimiters can be a very tricky proposition depending on how limited (or not) your input is. Even when you think you have it you can almost certainly find a case that will break it.

    Often a non-regex approach is clearer, easier to debug, and comparably fast.

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QRegExp for matching string between quotes with escaped quotes

    Qt Code:
    1. QRexgExp("\"(\\\\\"|[^\"])+\"")
    To copy to clipboard, switch view to plain text mode 
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Replies: 4
    Last Post: 30th August 2020, 19:44
  2. Replies: 7
    Last Post: 6th February 2017, 19:10
  3. QSqlQuery escaping single quotes
    By pdoria in forum Qt Programming
    Replies: 0
    Last Post: 1st April 2012, 21:37
  4. qmake LIBS missing quotes
    By redoctober0 in forum General Programming
    Replies: 1
    Last Post: 12th January 2011, 16:05
  5. QSqlQuery and single quotes using bindValue
    By Luc4 in forum Qt Programming
    Replies: 4
    Last Post: 26th September 2010, 23:34

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.