Results 1 to 2 of 2

Thread: How to work around QRegExp dot-matches-newline?

  1. #1
    Join Date
    Jan 2006
    Posts
    52
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to work around QRegExp dot-matches-newline?

    I'm trying to create a regular expression which will find every occurrence of a sentence enclosed in "" on a single line. I have tried this "\".\"" which doesn't work because the dot in QRegExp matches everything including newlines.

    Is there any other simple way to do this?

    Dave

  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: How to work around QRegExp dot-matches-newline?

    Try this:

    Qt Code:
    1. QRegExp rx("\"[^\"\n]*\"");
    To copy to clipboard, switch view to plain text mode 
    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. about newline
    By drizzlefsh in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2009, 19:21
  2. QTextBrowser NewLine
    By QbelcorT in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2009, 09:34
  3. Newline char combination in qstring
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2008, 13:18
  4. QRegExp doesn't seem to work as it should
    By thomaspu in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2007, 08:49
  5. Windows newline
    By indifference in forum Qt Programming
    Replies: 1
    Last Post: 29th August 2007, 02: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.