[Qt-interest] QRegExp and tab-delimited text

Atlant Schmidt aschmidt at dekaresearch.com
Mon Feb 7 12:49:22 CET 2011


Robert:

>    QRegExp xx("*[\\t]*");

  Remember, in RegExp language, "*" doesn't mean "wildcard match".
  Instead, it's a "quantifier", specifying that the previous RegExp
  atom must match 0 to infinite number of times. To get the wildcard
  match you're probably looking for, use ".*" (Match any character
  and (quantifier) match that any number of times in a row).

  So your whole RegExp becomes:

    ".*[\\t].*");

                                Atlant


-----Original Message-----
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Robert Hairgrove
Sent: Monday, February 07, 2011 06:16
To: Qt Interest
Subject: [Qt-interest] QRegExp and tab-delimited text

I'm trying to auto-detect tab-delimited text and am having trouble with
the simplest of regular expressions:

    //-------------------------------
    // This doesn't work:
    //-------------------------------
    QRegExp xx("*[\\t]*");
    QRegExp yy("*[\\t][\\t]*");
    int fa = xx.indexIn(first_row);
    int fb = yy.indexIn(first_row);
    //-------------------------------
    // This works:
    //-------------------------------
    int f1 = first_row.indexOf('\t');
    int f2 = first_row.indexOf("\t\t");
    //-------------------------------
    if ((f1>=0)||(f2>=0)) {
    // etc.

Can anybody point out the obvious to me, please?


_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.



More information about the Qt-interest-old mailing list