Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qregexp
    Log in to post

    • UNSOLVED QRegExp returning incorrect position due to codec ?
      General and Desktop • qfile qtextstream qregexp utf-8 codec • • Aramir  

      14
      0
      Votes
      14
      Posts
      217
      Views

      @Aramir said in QRegExp returning incorrect position due to codec ?: ve seen many SD cards/emmc die in ereaders (devices I'm aiming for) therefore I'm trying to lower the write operations on it in order to not reduce their lifetime. That's it I think it's worth the trouble to figure out a solution to this problem instead of creating more and more e-waste. Again a useless optimization due to a feeling. Optimize only when you can prove it's a problem and needs to be optimzied. You SD-Card has likely a sector size of 512 or 1024 bytes. On top of this your filesystem may use a block size up to 64kb (NTFS, ext4 use 4kb ). So when you even change single byte in your file which is less than the sector size or block size it will write the whole sector/block. It's just plain stupid and an over-complicating of things for nothing.
    • SOLVED Regex doesn't seem to work with Qt
      General and Desktop • qregexp • • Petross404_Petros S  

      15
      0
      Votes
      15
      Posts
      226
      Views

      @SGaist said in Regex doesn't seem to work with Qt: QRegularExpression::wildcardToRegularExpression is what you were looking for. I am afraid I can't use this function since it is very recent and compatiblity with Qt5.4 is needed. But thank you. @VRonin thank you too, your example was to the point. I will take a deeper look at what you did there. Thanks again.
    • SOLVED Extract a QString with a regular expression.
      General and Desktop • qstring qregexp split extract • • Patou355  

      12
      0
      Votes
      12
      Posts
      9211
      Views

      One small note, you are wasting CPU cycle here. The QRegularExpressionMatchIterator returns only match objects that contains a match thus the if is useless.
    • Matching a regular expression in string.
      General and Desktop • qstring qregexp • • NIXIN  

      4
      0
      Votes
      4
      Posts
      9318
      Views

      Sure, they are in the docs: http://doc.qt.io/qt-5/qregexp.html#code-examples indexIn() method should interest you in this case.
    • SOLVED QLineEdit using a QRegExpValidator doesn't take effect.
      General and Desktop • qlineedit qregexp qregexpvalidato • • Cysis145  

      5
      0
      Votes
      5
      Posts
      1652
      Views

      QRegularExpression rx("[A-Za-z0-9]*"); QRegularExpressionalidator *v = new QRegularExpressionValidator(rx, this); ui->LE_ObjectName->setValidator(v);
    • UNSOLVED Validating filename including predefined tags using QRegExp
      General and Desktop • qregexp regex • • Mammamia  

      1
      0
      Votes
      1
      Posts
      460
      Views

      No one has replied

    • SOLVED QregExp for IPv4 address (xxx.xxx.xxx.xxx)
      General and Desktop • qt 5.7 qregexp • • MarkoSan  

      5
      0
      Votes
      5
      Posts
      5700
      Views

      @MarkoSan said: are there any solutions for current code? either you enclose the RegExp pattern in tr() and trust the translator to do the right thing or you declare private: const QString logTags[3]; then in the constructor add the initialisation UeLogWindow::UeLogWindow(QWidget parent) : \\ ... other inits , logTags{tr("[INFO]"),tr("[WARNING]"),tr("[ERROR]")} (if you don't have access to C++11 functionality you should not declare const and initialise the members with the usual [] operator) this also simplifies a lot the switch(logEntryType) part to use them in the regular expression you then just have to call QRegularExpression::escape(). for example, ruleError.pattern=QRegExp("^\[ERROR\].*"); would become ruleError.pattern=QRegExp("^"+QRegExp::escape(logEntryType[2])+".*"); Again, here I used QRegExp but you should REALLY use QRegularExpression especially if you expect a big number of matches
    • SOLVED QRegExp not found
      General and Desktop • qregexp • • cfdev  

      3
      0
      Votes
      3
      Posts
      2261
      Views

      not the same (.*?) and (.*) I tested on QT4 and QT5 Ok I found the solution with this regular expression: QRegExp regex("\\<date(:(.*))?\\>");
    • SOLVED Strange behavior of QString::indexOf (with QRegExp)
      General and Desktop • qstring qregexp indexof • • Asperamanca  

      10
      0
      Votes
      10
      Posts
      4305
      Views

      Reading that report and thinking about it it makes sense that it is not an actual bug. For [a-z] it should not be escaped, since you want to match all characters from a up to character z. For [a\-z] you want to match character a, or character hyphen or character z.
    • QRegExp doesn't see \n character
      General and Desktop • qplaintextedit qregexp • • yutkin  

      2
      0
      Votes
      2
      Posts
      727
      Views

      What OS and Qt version are you using? On windows the end-of-line (EOL) marking is done by \r\n, although I'm not sure how it is done in the QPlainTextEdit class, but it may worth to give a try. IIRC QRegExp should be replaced QRegularExpression in recent code, but I don't think this is the problem. And I'm not sure about the regex you posted: the caret should negate the content of the class, therefore matching any character not being a number or a spacing, resulting in exactly the opposite. If you basically basically want to reject any string containing a letter, then you could try to reverse your regex to "[^a-z,A-z]+".
    • [Solved]QRegExpValidator Questions
      General and Desktop • qregexp qregexpvalidato • • Corpse0327  

      4
      0
      Votes
      4
      Posts
      1455
      Views

      You're welcome ! Sure thing Happy coding !
    • QRegExp vs QRegularExpression is always a question, but why is a cross-reference missing in docs?
      General and Desktop • documentation qregexp qregularexpress qtbug-46816 • • koahnig  

      3
      0
      Votes
      3
      Posts
      1462
      Views

      You are probably right. I have added a report on JIRA