Navigation

    Qt Forum

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

    • SOLVED Extract a QString with a regular expression.
      General and Desktop • qstring qregexp split extract • • Patou355  

      12
      0
      Votes
      12
      Posts
      7269
      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
      7646
      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
      1430
      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
      352
      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
      4609
      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
      843
      Views

      not the same (.*?) and (.*) I tested on QT4 and QT5 Ok I found the solution with this regular expression: QRegExp regex("\\<date(:(.*))?\\>");
    • UNSOLVED QRegExp выбрать строки в которых отсутствует слово.
      Russian • qregexp • • Privalov69  

      2
      0
      Votes
      2
      Posts
      863
      Views

      No one has replied

    • SOLVED Strange behavior of QString::indexOf (with QRegExp)
      General and Desktop • qstring qregexp indexof • • Asperamanca  

      10
      0
      Votes
      10
      Posts
      3874
      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
      663
      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
      1244
      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
      1347
      Views

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