From kde-core-devel Mon Aug 17 22:10:22 2009 From: Thomas =?iso-8859-15?q?L=FCbking?= Date: Mon, 17 Aug 2009 22:10:22 +0000 To: kde-core-devel Subject: Re: Review Request: Fix sanitization of dbus path in KMainWindow Message-Id: <200908180010.22838.thomas.luebking () web ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=125054734220402 static inline bool isIdentifier(char c) { // the order btw is [a-zA-Z_0-9] return (c > 96 && c < 123) || (c > 64 && c < 91) || c == '_' || (c > 47 && c < 58); } QByteArray ascii = o.objectName().toAscii(); const int n = ascii.length(); const char *data = ascii.data(); for (int i = 0; i < n; ++i) qDebug() << isIdentifier(data[i]); Am Monday 17 August 2009 schrieb Thiago Macieira: > No need for QRegExp. Just iterate over the string and change the > characters that aren't A-Z, a-z, 0-9 and underscore.