PDA

View Full Version : Method replace with Qregxp



mdjigo
24th June 2011, 12: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

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



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


I may be wrong in the regular expression.