Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-132397

QRegularExpression as a YARR replacement

XMLWordPrintable

    • s/yarr/QRegularExpression/g

      Regular expressions in QML are implemented by relying on (an internal fork of) a version of YARR (from Webkit).

      This has the benefit that the regexp engine is integrated with QML's memory manager (so memory usage from them is accounted on the QML heap, not the native heap).

      The disadvantage is that converting between QRegularExpression and QML RegExp objects is not free, and when "\u" or "\U" is used, there are also differences in behavior. As discussed in https://codereview.qt-project.org/c/qt/qtdeclarative/+/612762/1/src/qml/jsruntime/qv4regexp.cpp#229 it also requires quite a bit of (ROM)

       

      It is currently not possible to completely replace YARR due to differences in how the engine behaves. However, we could consider the following steps:

      1. We add proper support for QRegularExpression as an (optional) backend  for the JavaScript engine. This does also require adding a few changes to qtbase.
      2. We create a configuration where this backend is enabled, and YARR is not compiled. This would be added to the recent "Qt lite" configuration set
      3. We teach qmllint to warn about regular expressions which are behave differently between YARR and QRE/PCRE
      4. Long-term, we try to get upstream PCRE to add support for the features which are required to make it a drop-in replacement

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            diseraluca Luca Di Sera
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes