Results 1 to 7 of 7

Thread: QRegExp match all excpet "_"

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QRegExp match all excpet "_"

    Hello,
    i need a regular expression that match all the characters entred by the user except the character "_"
    Is it possible?
    thx

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QRegExp match all excpet "_"

    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 '_'

  3. The following user says thank you to ChristianEhrlicher for this useful post:

    mattia (28th March 2008)

  4. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QRegExp match all excpet "_"

    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:
    Qt Code:
    1. QRegExp _regexp ( "control input" );
    2. _lineEdit->setValidator ( new QRegExpValidator ( _regexp , this ) );
    To copy to clipboard, switch view to plain text mode 
    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

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QRegExp match all excpet "_"

    So what's in place of "control input" or does it present a regular expression?
    J-P Nurmi

  6. #5
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QRegExp match all excpet "_"

    no i need something to substitute to "control input"

  7. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QRegExp match all excpet "_"

    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...
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    mattia (28th March 2008)

  9. #7
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QRegExp match all excpet "_"

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.