View Full Version : Method replace with Qregxp

24th June 2011, 11:52
Hello everybody,
I have a QString object,and i want to replace slash,backslash and spaces to underscore character.
How can i do it with the method replace with qregxp

Thank you

Added after 35 minutes:

I found the solution of my problem.

myQString.replace(QRegExp("[\\\\/ ]"), QString("_"));

Thank you

24th June 2011, 11:52
If I understand You, try some construction:

QString s;
s.replace (QRegExp("^*[\\/ ]*"), "_");

I may be wrong in the regular expression.