Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QRegExp for everything inside [ ]





  • You'll just have to escape <code>[</code> and <code>]</code> within your pattern, as they are used to group expressions.
    @
    QRegExp pattern("[.*]"); // double slash, as you want to escape the
    // brackets within your pattern, not within
    // the string passed to the ctor
    @
    Be aware that if there are nested brackets you'll receive a greedy match, as QRegExp::setMinimal() is false per default.


Log in to reply