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. [Solved] Help with regular expressions
Forum Updated to NodeBB v4.3 + New Features

[Solved] Help with regular expressions

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.4k 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.
  • K Offline
    K Offline
    kbt90
    wrote on 3 Aug 2011, 19:35 last edited by
    #1

    I am trying to create a regular expression for a QLineEdit.

    The first character can be any of the following characters, except a '.'.
    The next 0 to 255 characters can be any of the characters listed.

    The following is my code:
    @QRegExp rx ("[A-Za-z0-9!#%&',+;={}~@()\-\[\]\^\$]{1} [A-Za-z0-9.!#%&',+;={}~@()\-\[\]\^\$]{0,255}");
    lineEdit->setValidator (new QRegExpValidator (rx, this));@

    If I just have the {0,255} expression in, it works just fine. But, once I add the {1} part in, I can only enter 1 character on my QLineEdit. What am I doing wrong?

    Thanks,
    Kate

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on 3 Aug 2011, 19:41 last edited by
      #2

      It looks like it's expecting a space after your first character. (Between the {1} and the [A-Za-z...)

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kbt90
        wrote on 3 Aug 2011, 19:44 last edited by
        #3

        Thanks so much! That was the problem.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on 3 Aug 2011, 19:45 last edited by
          #4

          Glad to help!

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0

          1/4

          3 Aug 2011, 19:35

          • 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