Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make impossible digit input in QRegex

How to make impossible digit input in QRegex

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 649 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mark_ua_1999
    wrote on last edited by
    #1

    HI, My regex QRegExp regexp("^[A-Za-z]+((\s)?(('|-|.)?([A-Za-z])+))*$"); hope your ideas will help
    0_1511368756480_Capture.PNG

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2
      • Don't use QRegExp, use QRegularExpression
      • Either escape \ or use raw string literals
      • . matches any char, including numbers, \. matches the dot (this is the root of your problem btw)
      • you can debug regular expressions here https://regex101.com/

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        In addition to what @VRonin wrote, there's the RegularExpression Example that provides an editor/tester for 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
        2

        • Login

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