Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QRegExp with QLineEdit
QtWS25 Last Chance

QRegExp with QLineEdit

Scheduled Pinned Locked Moved Mobile and Embedded
qregularexpressqlineedit
4 Posts 3 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Endar
    wrote on 6 May 2015, 14:28 last edited by
    #1

    How can I insert in a QLineEdit digits and letters but first 2 character I want to letters and then 3 digits and again 2 letters
    For eg: AA122BD ?

    E 1 Reply Last reply 6 May 2015, 14:35
    0
    • E Endar
      6 May 2015, 14:28

      How can I insert in a QLineEdit digits and letters but first 2 character I want to letters and then 3 digits and again 2 letters
      For eg: AA122BD ?

      E Offline
      E Offline
      Endar
      wrote on 6 May 2015, 14:35 last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 6 May 2015, 21:00 last edited by
        #3

        Hi,

        You can use the QRegExpValidator class. If you're on Qt 5 then please consider using QRegularExpression

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Buleron
          wrote on 7 May 2015, 07:08 last edited by Buleron 5 Jul 2015, 08:00
          #4

          @Endar
          I hope this will help you
          QRegExpValidator* validator = new QRegExpValidator(QRegExp("[A-a-Z-z][A-a-Z-z]\\d{0,2}\\d[A-a-Z-z][A-a-Z-z]"));
          ui->lineEdit->setValidator(validator);

          1 Reply Last reply
          0

          1/4

          6 May 2015, 14:28

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved