Results 1 to 6 of 6

Thread: Can't get the QRegExp I need

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't get the QRegExp I need

    There are square brackets (not always balanced) all over the pattern strings you wrote. You should re-read the documentation of QRegExp (especially the paragraph called "Introduction", which describes the syntax and semantics of the square brackets) and you will understand what is going on.

  2. #2
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't get the QRegExp I need

    Oh I see, the brackets of DG are the problem. Thank you! I thought that it worked in other way until I re-read it

    But I have still another problem, it accepts either 123DG1234 and 123DG12 which is wrong

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't get the QRegExp I need

    Quote Originally Posted by roseicollis View Post
    But I have still another problem, it accepts either 123DG1234 and 123DG12 which is wrong
    Can you post a code sample reproducing the problem? If you get the pattern right, then QRegExpValidator::validate("123DG12", 0) should return QValidator::Intermediate.

  4. #4
    Join Date
    Dec 2014
    Posts
    82
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't get the QRegExp I need

    Hi yeye thx for your help but Its solved now I just had to use exact match in that case only dunno why but... it works so.. Problem solved.

  5. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Can't get the QRegExp I need

    I would recommend that you use QRegularExpression instead of QRegExp in any new code you are writing/fixing. QRegularExpression supports Perl Compatible Regular Expression (PCRE) and much better IMHO.

Similar Threads

  1. Please help on QRegExp
    By lni in forum Qt Programming
    Replies: 6
    Last Post: 25th September 2011, 07:42
  2. QRegExp Help
    By ToddAtWSU in forum Qt Programming
    Replies: 6
    Last Post: 16th November 2010, 15:35
  3. QRegExp
    By tebessum in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2008, 18:44
  4. QRegExp help
    By Lele in forum Qt Programming
    Replies: 2
    Last Post: 8th February 2008, 10:07
  5. QRegExp Help
    By Ahmad in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2007, 00:13

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
  •  
Qt is a trademark of The Qt Company.