Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QString count replacements
Volebab last edited by
Is there a way to use
QRegularExpressionand count how many times it has replaced strings?
For example, imagine that I have a string with:
xaxbxc, and I want to replace "x" with "-", is there a way to know how many times `QRegularExpression' replaced? In this case it would return "3".
QString str = "banana and panama";
str.count(QRegularExpression("a[nm]a")); // returns 4