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

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 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
    0
    • E Endar

      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 last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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
        • BuleronB Offline
          BuleronB Offline
          Buleron
          wrote on last edited by Buleron
          #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

          • Login

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