thanks for any help in advance. I'm quite new to qt so please excuse my newbie question.
I want to replace image1="jdjddsj" with "im" with a regular expression in a string. There are more of these partes with xx="..." in my string, so I wanted to run QRegExp greedy, which somehow doesn't seem to work.
QString str_commando;
str_commando = "python python.py image1=\"sonstzweiteil\" one! path=\"sonstwas\" image2=\"sonsteinanderes\" two!"
QString str(str_commando); // The initial string.
qDebug() << str_commando.remove(QRegExp ("age1=\"([^>]*)\""));
/* Set field */
ui->lineeCommand->setText(str_commando);
Result is unfortunately: python python.py im two!
qDebug() << str_commando.remove(QRegExp ("age1=\"([^>]*)\""));
I have tried it with before. Same result.
Where am I going wrong? Thanks for your help in advance!
SOLUTION:
qDebug() << str_commando.replace(QRegExp ("image1=\"([^\"]*)\""), "im");
"age1=\"([^>\"]*)\"". If you'd like a nongreedy pattern, you may try"age1=\"([^>]*?)\""But I don't know if QT supports that.