[Qt-interest] removing specialcharacters for filenames

Alexander Poddey alexander.poddey at gmx.net
Thu Sep 3 20:45:59 CEST 2009


Thanks Ben,

starting fromyour regexp, I digged a little deeper and found:

qt/doc/html/qregexp.html#characters-and-abbreviations-for-sets-of-characters

\W is pretty much what i meant:

simplified.replace( QRegExp("\\W"),QString(""));

a little more conservative (keeps all a-Z letters and numbers):
simplified.replace( QRegExp("[^a-zA-Z0-9]"),QString(""));

or even
simplified.replace( QRegExp("[^a-z]"),QString(""));


thx alex



More information about the Qt-interest-old mailing list