QRegExp not found
Solved
General and Desktop
-
Hi all,
I try to use QRegExp to find and replace text with this code:QString text = "FC<date:yyMM><index>"; QRegExp expDate( "<date:(.*?)>" ); pos = expDate.indexIn( text ); if (pos > -1) { qDebug()<< "database::checkCodeExp" << expDate.cap(1) << " " << expDate.cap(2); text.replace(expDate,"DATE"); }else{ qDebug()<< "database::checkCodeExp notFound" << text << " regExp: "<< expDate.pattern(); }
This expression "date:(.*?)" works with the tester php https://regex101.com/
What am I doing wrong ? -
@cfdev said:
Isn't(.*?)
the same as(.*)
? It looks that way to me. If you're using Qt5 do consider using the replacement(s) for QRegExp - QRegularExpression which is perl compatible.