Where can I find the documentation about QGIS regular expression engine and how to craft a pattern with it. I see the following regex functions documented
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
QRegularExpression implements Perl-compatible regular expressions. It fully supports Unicode. For an overview of the regular expression syntax supported by QRegularExpression, please refer to the aforementioned pcrepattern(3) man page. A regular expression is made up of two things: a pattern string and a set of pattern options that change the meaning of the pattern string.
You can see the use of it in src/core/qgsexpression.cpp
Note one Gotcha with the QT C++ implementation is that you have to escape
Note that due to C++ literal strings rules, you must escape all backslashes inside the pattern string with another backslash:
// matches two digits followed by a space and a word QRegularExpression re("\\d\\d \\w+"); // matches a backslash QRegularExpression re2("\\\\");
Another but very minor non-gotcha, is
QRegularExpression does not support all the features available in Perl-compatible regular expressions. The most notable one is the fact that duplicated names for capturing groups are not supported, and using them can lead to undefined behaviour.