PDA

View Full Version : QRegExp match all excpet "_"



mattia
28th March 2008, 11:51
Hello,
i need a regular expression that match all the characters entred by the user except the character "_"
Is it possible?
thx

ChristianEhrlicher
28th March 2008, 12:04
Yes it's possible.

Did you try to create such a regexp? But I would not use a regexp at all - just search the string for '_'

mattia
28th March 2008, 12:30
i have to control a QLineEdit input a runtime, 'cause i need to check the character typed by the user...i set a validator in this way:


QRegExp _regexp ( "control input" );
_lineEdit->setValidator ( new QRegExpValidator ( _regexp , this ) );

so i can't do it in the way that u suggested before, maybe i have not been clear enough during in my problem explanation :)

jpn
28th March 2008, 12:48
So what's in place of "control input" or does it present a regular expression? :)

mattia
28th March 2008, 13:13
no i need something to substitute to "control input" :)

jpn
28th March 2008, 13:20
Have you tried anything yourself? Did you decide not to bother reading QRegExp docs and ask here instead? Go read through the detailed description of QRegExp docs. The answer is there. The reference documentation is your number one resource. Read the docs first, then come ask here if problems occur...

mattia
28th March 2008, 13:53
i did it in this way:
"[^controlString]+"
where controlString is a characters ban list
:)
maybe a deserve a "thanks" by myself but i can't apply it :(