[Solved] Help with regular expressions
General and Desktop
4
Posts
2
Posters
2.4k
Views
1
Watching
-
wrote on 3 Aug 2011, 19:35 last edited by
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 -
wrote on 3 Aug 2011, 19:41 last edited by
It looks like it's expecting a space after your first character. (Between the {1} and the [A-Za-z...)
-
wrote on 3 Aug 2011, 19:44 last edited by
Thanks so much! That was the problem.
-
wrote on 3 Aug 2011, 19:45 last edited by
Glad to help!
1/4