Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Condition in QRegExp
UriahHeep last edited by
The following code is does not work. Why?
QRegExp *reg = new QRegExp("(?(x)y|z)"); // pattern: (?(if)then|else)
qDebug() << reg->exactMatch("xy"); // return 'false'
b1gsnak3 last edited by
try qDebug() << reg->isValid(); to see if the pattern is correct.
Also I think the "?" should be at the end of the pattern.. Might be wrong, didn't use qregexp with ? as of yet
koahnig last edited by
One thing you might want to try out is the regexp example. For learning a bit more of regexp and its behaviour it is quite handy.
Check on *\examples\widgets\tools\regexp for Qt5.1.0 for Qt 4 it was under *\examples\tools\regexp