Results 1 to 5 of 5

Thread: QRegExp for removing all non alphanumeric charecters

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Czech Republic
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 1 Time in 1 Post

    Default Re: QRegExp for removing all non alphanumeric charecters

    Seems to be working (Calhal's solution would work only with ascii - no interpunction characters).

  2. #2
    Join Date
    Oct 2013
    Location
    Quebec
    Posts
    31
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    4

    Default Re: QRegExp for removing all non alphanumeric charecters

    Hey, Sorry to revive an old thread.

    I am using your solution:

    Qt Code:
    1. QString Util::cleanQString(QString toClean) {
    2.  
    3. QString toReturn = toClean;
    4. toReturn.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\\[\\\]\\\\]")));
    5. return toReturn;
    6. }
    To copy to clipboard, switch view to plain text mode 

    The compiler is giving me theses 4 warnings that I would like to fix:
    warning: C4129: '[' : unrecognized character escape sequence
    warning: C4129: ']' : unrecognized character escape sequence
    warning: C4129: '[' : unrecognized character escape sequence
    warning: C4129: ']' : unrecognized character escape sequence

    Using Qt 5.5.0 on VS2013

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.